From 40fd876d1edb1a376a4eb592c9de4a178352a760 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Tue, 2 Apr 2019 15:57:30 +0800 Subject: [PATCH] Set `force_https` to true when Let's Encrypt cert checks out OK. --- templates/web.letsencrypt.ssl.template.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/web.letsencrypt.ssl.template.yml b/templates/web.letsencrypt.ssl.template.yml index 3a43d4e..463f04e 100644 --- a/templates/web.letsencrypt.ssl.template.yml +++ b/templates/web.letsencrypt.ssl.template.yml @@ -61,6 +61,8 @@ hooks: if [ ! "$(cd $$ENV_LETSENCRYPT_DIR/$$ENV_DISCOURSE_HOSTNAME && openssl verify -CAfile ca.cer fullchain.cer | grep "OK")" ]; then # Try to issue the cert again if something goes wrong LE_WORKING_DIR="${LETSENCRYPT_DIR}" $$ENV_LETSENCRYPT_DIR/acme.sh --issue -d $$ENV_DISCOURSE_HOSTNAME -k 4096 --force -w /var/www/discourse/public + else + echo "force_https = 'true'" >> "/var/www/discourse/config/discourse.conf" fi LE_WORKING_DIR="${LETSENCRYPT_DIR}" $$ENV_LETSENCRYPT_DIR/acme.sh --installcert -d $$ENV_DISCOURSE_HOSTNAME --fullchainpath /shared/ssl/$$ENV_DISCOURSE_HOSTNAME.cer --keypath /shared/ssl/$$ENV_DISCOURSE_HOSTNAME.key --reloadcmd "sv reload nginx" -- 2.25.1