From 9ee4d49cb7a9b5619e4a4bec6b33e4841fefb4e1 Mon Sep 17 00:00:00 2001 From: neilpang Date: Sat, 3 Jun 2017 16:52:12 +0800 Subject: [PATCH] fix typos --- Dockerfile | 2 +- nginx.tmpl | 2 +- updatessl.sh | 34 +++++++++++++++++++--------------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index f815a86..ead0378 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get update \ && apt-get clean \ && rm -r /var/lib/apt/lists/* -RUN AUTOUPGRADE=1 LE_WORKING_DIR=/acme.sh LE_CONFIG_HOME /acmecerts wget -O- https://get.acme.sh | sh +RUN AUTOUPGRADE=1 LE_WORKING_DIR=/acme.sh LE_CONFIG_HOME=/acmecerts wget -O- https://get.acme.sh | sh # Configure Nginx and apply fix for very long server names RUN echo "daemon off;" >> /etc/nginx/nginx.conf \ diff --git a/nginx.tmpl b/nginx.tmpl index 22583dc..904e108 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -106,7 +106,7 @@ server { {{ $enable_acme := eq (or ($.Env.ENABLE_ACME) "") "true" }} {{ if $enable_acme }} -#{{ACMD_DOMAINS $host_list}} +#ACME_DOMAINS{{$host_list}} {{ end }} # {{ $host }} upstream {{ $upstream_name }} { diff --git a/updatessl.sh b/updatessl.sh index 882fa9c..92791da 100644 --- a/updatessl.sh +++ b/updatessl.sh @@ -13,22 +13,26 @@ CERTS="/etc/nginx/certs" updatessl() { - for d_list in $(grep ACMD_DOMAINS $DEFAULT_CONF | cut -d ' ' -f 2); - do - d=$(echo "$d_list" | cut -d , -f 1) - $ACME_BIN --issue \ - -d $d_list \ - -w $NGINX_HOME/html \ - --pre-hook "$_SCRIPT_ pre_hook $DEFAULT_CONF" \ - --post-hook "$_SCRIPT_ post_hook $DEFAULT_CONF" \ - --fullchain-file "$CERTS\$d.crt" \ - --key-file "$CERTS\$d.crt" \ - --reloadcmd "service nginx configtest && service force-reload" - done + if grep ACME_DOMAINS $DEFAULT_CONF ; then + for d_list in $(grep ACME_DOMAINS $DEFAULT_CONF | cut -d ' ' -f 2); + do + d=$(echo "$d_list" | cut -d , -f 1) + $ACME_BIN --issue \ + -d $d_list \ + -w $NGINX_HOME/html \ + --pre-hook "$_SCRIPT_ pre_hook $DEFAULT_CONF" \ + --post-hook "$_SCRIPT_ post_hook $DEFAULT_CONF" \ + --fullchain-file "$CERTS\$d.crt" \ + --key-file "$CERTS\$d.crt" \ + --reloadcmd "service nginx configtest && service force-reload" + done - #generate nginx conf again. - docker-gen /app/nginx.tmpl /etc/nginx/conf.d/default.conf - service nginx configtest && service force-reload + #generate nginx conf again. + docker-gen /app/nginx.tmpl /etc/nginx/conf.d/default.conf + service nginx configtest && service force-reload + else + echo "skip updatessl" + fi }