From 2902a99a81a51dcc8cbb6303f0dbd2cd16253e5a Mon Sep 17 00:00:00 2001 From: genofire Date: Fri, 18 Sep 2020 12:41:54 +0200 Subject: [PATCH] improve https support --- README.md | 3 ++- defaults/main.yml | 1 + templates/gitea.ini.j2 | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 46c2378..e8db3ff 100644 --- a/README.md +++ b/README.md @@ -88,8 +88,9 @@ The following code has been tested with Debian 8, it should work on Ubuntu as we * `gitea_root_url`: Root URL used to access your web app (full URL) * `gitea_protocol`: Listening protocol (http/https) * `gitea_http_listen`: Bind address -* `gitea_http_port`: Bind port +* `gitea_http_port`: Bind port (redirect from `80` will be activated if value is `443` - Default: `3000`) * `gitea_disable_http_git`: Disable the use of Git over HTTP ? (true/false) +* `gitea_http_letsencrypt_mail` Enable Let`s Encrypt if a email address is given ### SSH configuration diff --git a/defaults/main.yml b/defaults/main.yml index 7ab9403..cefc8e5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -17,6 +17,7 @@ gitea_root_url: http://localhost:3000 gitea_protocol: http gitea_http_listen: 127.0.0.1 gitea_http_port: 3000 +# gitea_http_letsencrypt_mail: - required gitea_disable_http_git: false gitea_offline_mode: true diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index f70ec57..552ca0b 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -37,6 +37,14 @@ ROOT_URL = {{ gitea_root_url }} ; The address to listen on. Either a IPv4/IPv6 address or the path to a unix socket. HTTP_ADDR = {{ gitea_http_listen }} HTTP_PORT = {{ gitea_http_port }} +{% if gitea_http_port == 443 %} +PORT_TO_REDIRECT = 80 +{% endif %} +{% if gitea_http_letsencrypt_mail is defined %} +ENABLE_LETSENCRYPT = true +LETSENCRYPT_ACCEPTTOS = true +LETSENCRYPT_EMAIL = {{ gitea_http_letsencrypt_mail }} +{% endif %} ; Disable SSH feature when not available DISABLE_SSH = false ; Whether to use the builtin SSH server or not.