Skip to content

Commit

Permalink
refactor: DNS-01 variables are scoped to the function
Browse files Browse the repository at this point in the history
  • Loading branch information
buchdag committed Jul 16, 2024
1 parent b356f51 commit 1c9c0db
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions app/letsencrypt_service
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function update_cert {
[[ "$key" == "DNS_API" ]] && continue
dns_api_keys+=("$key")
local value="${acmesh_dns_config[$key]}"
declare -x "$key"="$value"
local -x "$key"="$value"
done

echo "Info: DNS challenge using $acmesh_dns_api DNS API with the following keys: ${dns_api_keys[*]}"
Expand Down Expand Up @@ -420,16 +420,6 @@ function update_cert {

local acmesh_return=$?

# DNS challenge: clean environment variables
if [[ "$acme_challenge" == "DNS-01" ]]; then
local -n acmesh_dns_config="ACMESH_${cid}_DNS_API_CONFIG"
# Loop over defined variable for acme.sh DNS api config
for key in "${!acmesh_dns_config[@]}"; do
[[ "$key" == "DNS_API" ]] && continue
unset "$key"
done
fi

# 0 = success, 2 = RENEW_SKIP
if [[ $acmesh_return == 0 || $acmesh_return == 2 ]]; then
for domain in "${hosts_array[@]}"; do
Expand Down

0 comments on commit 1c9c0db

Please sign in to comment.