fix renew server

This commit is contained in:
neil 2022-05-09 22:12:07 +08:00
parent 8b7a86bd17
commit 38778f8adc

20
acme.sh
View File

@ -20,8 +20,6 @@ _SUB_FOLDER_DEPLOY="deploy"
_SUB_FOLDERS="$_SUB_FOLDER_DNSAPI $_SUB_FOLDER_DEPLOY $_SUB_FOLDER_NOTIFY" _SUB_FOLDERS="$_SUB_FOLDER_DNSAPI $_SUB_FOLDER_DEPLOY $_SUB_FOLDER_NOTIFY"
CA_LETSENCRYPT_V1="https://acme-v01.api.letsencrypt.org/directory"
CA_LETSENCRYPT_V2="https://acme-v02.api.letsencrypt.org/directory" CA_LETSENCRYPT_V2="https://acme-v02.api.letsencrypt.org/directory"
CA_LETSENCRYPT_V2_TEST="https://acme-staging-v02.api.letsencrypt.org/directory" CA_LETSENCRYPT_V2_TEST="https://acme-staging-v02.api.letsencrypt.org/directory"
@ -5257,6 +5255,7 @@ renew() {
_debug "_renewServer" "$_renewServer" _debug "_renewServer" "$_renewServer"
_initpath "$Le_Domain" "$_isEcc" _initpath "$Le_Domain" "$_isEcc"
_set_level=${NOTIFY_LEVEL:-$NOTIFY_LEVEL_DEFAULT} _set_level=${NOTIFY_LEVEL:-$NOTIFY_LEVEL_DEFAULT}
_info "$(__green "Renew: '$Le_Domain'")" _info "$(__green "Renew: '$Le_Domain'")"
if [ ! -f "$DOMAIN_CONF" ]; then if [ ! -f "$DOMAIN_CONF" ]; then
@ -5271,12 +5270,6 @@ renew() {
. "$DOMAIN_CONF" . "$DOMAIN_CONF"
_debug Le_API "$Le_API" _debug Le_API "$Le_API"
if [ "$_renewServer" ]; then
export ACME_DIRECTORY="$_renewServer"
else
export ACME_DIRECTORY="$Le_API"
fi
case "$Le_API" in case "$Le_API" in
"$CA_LETSENCRYPT_V2_TEST") "$CA_LETSENCRYPT_V2_TEST")
_info "Switching back to $CA_LETSENCRYPT_V2" _info "Switching back to $CA_LETSENCRYPT_V2"
@ -5292,18 +5285,21 @@ renew() {
;; ;;
esac esac
if [ "$Le_API" ] && [ "$ACME_DIRECTORY" ]; then if [ "$_server" ]; then
if [ "$Le_API" != "$ACME_DIRECTORY" ]; then Le_API="$_server"
fi
_info "Renew to Le_API=$Le_API"
export ACME_DIRECTORY="$Le_API"
_clearAPI _clearAPI
_clearCA _clearCA
fi
#reload ca configs #reload ca configs
ACCOUNT_KEY_PATH="" ACCOUNT_KEY_PATH=""
ACCOUNT_JSON_PATH="" ACCOUNT_JSON_PATH=""
CA_CONF="" CA_CONF=""
_debug2 "initpath again." _debug2 "initpath again."
_initpath "$Le_Domain" "$_isEcc" _initpath "$Le_Domain" "$_isEcc"
fi
if [ -z "$FORCE" ] && [ "$Le_NextRenewTime" ] && [ "$(_time)" -lt "$Le_NextRenewTime" ]; then if [ -z "$FORCE" ] && [ "$Le_NextRenewTime" ] && [ "$(_time)" -lt "$Le_NextRenewTime" ]; then
_info "Skip, Next renewal time is: $(__green "$Le_NextRenewTimeStr")" _info "Skip, Next renewal time is: $(__green "$Le_NextRenewTimeStr")"