From 0dcb32eed6f72219e1ac6844a22c519f68dd3db6 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 | 12 ++++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d28a54e..4286330 100644 --- a/README.md +++ b/README.md @@ -93,8 +93,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 b2f00b4..c35b4d9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,6 +20,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 11e06c0..a10939d 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -35,8 +35,16 @@ PROTOCOL = {{ gitea_protocol }} DOMAIN = {{ gitea_http_domain }} 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 }} +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.