From c66cedaf97c84de1e16e9205631db1454b7d68c6 Mon Sep 17 00:00:00 2001 From: Nicolas Duchon Date: Thu, 30 May 2024 22:30:21 +0200 Subject: [PATCH] feat: disable location configuration by default --- app/entrypoint.sh | 7 +++++-- app/letsencrypt_service | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/entrypoint.sh b/app/entrypoint.sh index d9a836a..75553f8 100755 --- a/app/entrypoint.sh +++ b/app/entrypoint.sh @@ -167,10 +167,13 @@ if [[ "$*" == "/bin/bash /app/start.sh" ]]; then exit 1 fi check_writable_directory '/etc/nginx/certs' - check_writable_directory '/etc/nginx/vhost.d' + parse_true "${ACME_HTTP_CHALLENGE_LOCATION:=false}" && check_writable_directory '/etc/nginx/vhost.d' check_writable_directory '/etc/acme.sh' check_writable_directory '/usr/share/nginx/html' - [[ -f /app/letsencrypt_user_data ]] && check_writable_directory '/etc/nginx/conf.d' + if [[ -f /app/letsencrypt_user_data ]]; then + check_writable_directory '/etc/nginx/vhost.d' + check_writable_directory '/etc/nginx/conf.d' + fi check_default_cert_key check_dh_group reload_nginx diff --git a/app/letsencrypt_service b/app/letsencrypt_service index b5d0185..451f312 100755 --- a/app/letsencrypt_service +++ b/app/letsencrypt_service @@ -348,8 +348,10 @@ function update_cert { for domain in "${hosts_array[@]}"; do # Add all the domains to certificate params_issue_arr+=(--domain "$domain") - # Add location configuration for the domain - add_location_configuration "$domain" || reload_nginx + # If enabled, add location configuration for the domain + if parse_true "${ACME_HTTP_CHALLENGE_LOCATION:=false}"; then + add_location_configuration "$domain" || reload_nginx + fi done params_issue_arr=("${params_base_arr[@]}" "${params_issue_arr[@]}")