diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 12b1009..bb76121 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -23,12 +23,12 @@ server { } NGINXCONF - trap 'rm -f "/opt/hantim/docker/nginx/conf.d/$APP.conf"' EXIT + trap 'git -C /opt/hantim restore "docker/nginx/conf.d/$APP.conf" 2>/dev/null || rm -f "/opt/hantim/docker/nginx/conf.d/$APP.conf"' EXIT docker exec nginx nginx -t && docker exec nginx nginx -s reload certbot certonly --webroot -w /opt/hantim/docker/nginx/certbot/www \ --non-interactive --agree-tos -m timothykim@fastmail.fm \ --cert-name "$APP" -d "$APP" -d "www.$APP" - rm -f "/opt/hantim/docker/nginx/conf.d/$APP.conf" + git -C /opt/hantim restore "docker/nginx/conf.d/$APP.conf" 2>/dev/null || rm -f "/opt/hantim/docker/nginx/conf.d/$APP.conf" trap - EXIT echo "Certificate issued for $APP" exit 0