mirror of
https://github.com/nginx-proxy/docker-letsencrypt-nginx-proxy-companion
synced 2024-11-23 00:52:02 +01:00
feat: per-container Pre-Hooks and Post-Hooks
This commit is contained in:
parent
312fe57bb8
commit
b9e7d59bed
@ -221,11 +221,15 @@ function update_cert {
|
|||||||
)
|
)
|
||||||
|
|
||||||
# acme.sh pre and post hooks
|
# acme.sh pre and post hooks
|
||||||
if [[ -n "$ACME_PRE_HOOK" ]]; then
|
local -n acme_pre_hook="ACME_${cid}_PRE_HOOK"
|
||||||
params_issue_arr+=(--pre-hook "$ACME_PRE_HOOK")
|
acme_pre_hook=${acme_pre_hook:-$ACME_PRE_HOOK}
|
||||||
|
if [[ -n "${acme_pre_hook// }" ]]; then
|
||||||
|
params_issue_arr+=(--pre-hook "$acme_pre_hook")
|
||||||
fi
|
fi
|
||||||
if [[ -n "$ACME_POST_HOOK" ]]; then
|
local -n acme_post_hook="ACME_${cid}_POST_HOOK"
|
||||||
params_issue_arr+=(--post-hook "$ACME_POST_HOOK")
|
acme_post_hook=${acme_post_hook:-$ACME_POST_HOOK}
|
||||||
|
if [[ -n "${acme_post_hook// }" ]]; then
|
||||||
|
params_issue_arr+=(--post-hook "$acme_post_hook")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ ! -d "$config_home" ]] && mkdir -p "$config_home"
|
[[ ! -d "$config_home" ]] && mkdir -p "$config_home"
|
||||||
|
@ -31,6 +31,8 @@ LETSENCRYPT_CONTAINERS=(
|
|||||||
{{ $EAB_HMAC_KEY := trim (coalesce $container.Env.ACME_EAB_HMAC_KEY "") }}
|
{{ $EAB_HMAC_KEY := trim (coalesce $container.Env.ACME_EAB_HMAC_KEY "") }}
|
||||||
{{ $ZEROSSL_API_KEY := trim (coalesce $container.Env.ZEROSSL_API_KEY "") }}
|
{{ $ZEROSSL_API_KEY := trim (coalesce $container.Env.ZEROSSL_API_KEY "") }}
|
||||||
{{ $RESTART_CONTAINER := trim (coalesce $container.Env.LETSENCRYPT_RESTART_CONTAINER "") }}
|
{{ $RESTART_CONTAINER := trim (coalesce $container.Env.LETSENCRYPT_RESTART_CONTAINER "") }}
|
||||||
|
{{ $PRE_HOOK := trim (coalesce $container.Env.ACME_PRE_HOOK "") }}
|
||||||
|
{{ $POST_HOOK := trim (coalesce $container.Env.ACME_POST_HOOK "") }}
|
||||||
{{ $cid := printf "%.12s" $container.ID }}
|
{{ $cid := printf "%.12s" $container.ID }}
|
||||||
{{ if parseBool (coalesce $container.Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS "false") }}
|
{{ if parseBool (coalesce $container.Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS "false") }}
|
||||||
{{/* Explicit per-domain splitting of the certificate */}}
|
{{/* Explicit per-domain splitting of the certificate */}}
|
||||||
@ -49,6 +51,8 @@ LETSENCRYPT_CONTAINERS=(
|
|||||||
{{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_EAB_HMAC_KEY="{{ $EAB_HMAC_KEY }}"
|
{{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_EAB_HMAC_KEY="{{ $EAB_HMAC_KEY }}"
|
||||||
{{- "\n" }}ZEROSSL_{{ $cid }}_{{ $hostHash }}_API_KEY="{{ $ZEROSSL_API_KEY }}"
|
{{- "\n" }}ZEROSSL_{{ $cid }}_{{ $hostHash }}_API_KEY="{{ $ZEROSSL_API_KEY }}"
|
||||||
{{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_RESTART_CONTAINER="{{ $RESTART_CONTAINER }}"
|
{{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_RESTART_CONTAINER="{{ $RESTART_CONTAINER }}"
|
||||||
|
{{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_PRE_HOOK="{{ $PRE_HOOK }}"
|
||||||
|
{{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_POST_HOOK="{{ $POST_HOOK }}"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{/* Default: multi-domain (SAN) certificate */}}
|
{{/* Default: multi-domain (SAN) certificate */}}
|
||||||
@ -69,6 +73,8 @@ LETSENCRYPT_CONTAINERS=(
|
|||||||
{{- "\n" }}ACME_{{ $cid }}_EAB_HMAC_KEY="{{ $EAB_HMAC_KEY }}"
|
{{- "\n" }}ACME_{{ $cid }}_EAB_HMAC_KEY="{{ $EAB_HMAC_KEY }}"
|
||||||
{{- "\n" }}ZEROSSL_{{ $cid }}_API_KEY="{{ $ZEROSSL_API_KEY }}"
|
{{- "\n" }}ZEROSSL_{{ $cid }}_API_KEY="{{ $ZEROSSL_API_KEY }}"
|
||||||
{{- "\n" }}LETSENCRYPT_{{ $cid }}_RESTART_CONTAINER="{{ $RESTART_CONTAINER }}"
|
{{- "\n" }}LETSENCRYPT_{{ $cid }}_RESTART_CONTAINER="{{ $RESTART_CONTAINER }}"
|
||||||
|
{{- "\n" }}ACME_{{ $cid }}_PRE_HOOK="{{ $PRE_HOOK }}"
|
||||||
|
{{- "\n" }}ACME_{{ $cid }}_POST_HOOK="{{ $POST_HOOK }}"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user