mirror of
https://github.com/nginx-proxy/docker-letsencrypt-nginx-proxy-companion
synced 2025-02-22 09:41:09 +01:00
86 lines
4.8 KiB
Go HTML Template
86 lines
4.8 KiB
Go HTML Template
{{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }}
|
|
{{ $scopedContainersString := "" }}
|
|
|
|
{{ range $hosts, $containers := groupBy $ "Env.LETSENCRYPT_HOST" }}
|
|
{{ if trim $hosts }}
|
|
{{ range $container := $containers }}
|
|
{{ $cid := printf "%.12s" $container.ID }}
|
|
{{ if $CurrentContainer.Env.NETWORK_SCOPE }}
|
|
{{ range $containerNetwork := $container.Networks }}
|
|
{{ if eq $CurrentContainer.Env.NETWORK_SCOPE $containerNetwork.Name }}
|
|
{{ $scopedContainersString = (printf "%s %s" $scopedContainersString $cid) }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ else }}
|
|
{{ $scopedContainersString = (printf "%s %s" $scopedContainersString $cid) }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ $scopedContainersSlice := split (trim $scopedContainersString) " " }}
|
|
|
|
LETSENCRYPT_CONTAINERS=(
|
|
{{ range $hosts, $containers := groupBy $ "Env.LETSENCRYPT_HOST" }}
|
|
{{ if trim $hosts }}
|
|
{{ range $container := $containers }}
|
|
{{ $cid := printf "%.12s" $container.ID }}
|
|
{{ if intersect $scopedContainersSlice (split $cid " ") }}
|
|
{{ if parseBool (coalesce $container.Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS "false") }}
|
|
{{ range $host := split $hosts "," }}
|
|
{{- "\t"}}'{{ printf "%s_%s" $cid (sha1 (trim $host)) }}'
|
|
{{ end }}
|
|
{{ else }}
|
|
'{{ $cid }}'
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
)
|
|
|
|
{{ range $hosts, $containers := groupBy $ "Env.LETSENCRYPT_HOST" }}
|
|
{{ $hosts := trimSuffix "," $hosts }}
|
|
{{ range $container := $containers }}
|
|
{{ $cid := printf "%.12s" $container.ID }}
|
|
{{ if intersect $scopedContainersSlice (split $cid " ") }}
|
|
{{ if parseBool (coalesce $container.Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS "false") }}
|
|
{{ range $host := split $hosts "," }}
|
|
{{ $host := trim $host }}
|
|
{{ $host := trimSuffix "." $host }}
|
|
{{ $hostHash := sha1 $host }}
|
|
{{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_HOST=('{{ $host }}')
|
|
{{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_KEYSIZE="{{ $container.Env.LETSENCRYPT_KEYSIZE }}"
|
|
{{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_TEST="{{ $container.Env.LETSENCRYPT_TEST }}"
|
|
{{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_EMAIL="{{ $container.Env.LETSENCRYPT_EMAIL }}"
|
|
{{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_CA_URI="{{ $container.Env.ACME_CA_URI }}"
|
|
{{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_PREFERRED_CHAIN="{{ $container.Env.ACME_PREFERRED_CHAIN }}"
|
|
{{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_OCSP="{{ $container.Env.ACME_OCSP }}"
|
|
{{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_EAB_KID="{{ $container.Env.ACME_EAB_KID }}"
|
|
{{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_EAB_HMAC_KEY="{{ $container.Env.ACME_EAB_HMAC_KEY }}"
|
|
{{- "\n" }}ZEROSSL_{{ $cid }}_{{ $hostHash }}_API_KEY="{{ $container.Env.ZEROSSL_API_KEY }}"
|
|
{{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_RESTART_CONTAINER="{{ $container.Env.LETSENCRYPT_RESTART_CONTAINER }}"
|
|
{{ end }}
|
|
{{ else }}
|
|
{{- "\n" }}LETSENCRYPT_{{ $cid }}_HOST=(
|
|
{{- range $host := split $hosts "," }}
|
|
{{- $host := trim $host }}
|
|
{{- $host := trimSuffix "." $host -}}
|
|
'{{ $host }}'{{ " " }}
|
|
{{- end -}}
|
|
)
|
|
{{- "\n" }}LETSENCRYPT_{{ $cid }}_KEYSIZE="{{ $container.Env.LETSENCRYPT_KEYSIZE }}"
|
|
{{- "\n" }}LETSENCRYPT_{{ $cid }}_TEST="{{ $container.Env.LETSENCRYPT_TEST }}"
|
|
{{- "\n" }}LETSENCRYPT_{{ $cid }}_EMAIL="{{ $container.Env.LETSENCRYPT_EMAIL }}"
|
|
{{- "\n" }}ACME_{{ $cid }}_CA_URI="{{ $container.Env.ACME_CA_URI }}"
|
|
{{- "\n" }}ACME_{{ $cid }}_PREFERRED_CHAIN="{{ $container.Env.ACME_PREFERRED_CHAIN }}"
|
|
{{- "\n" }}ACME_{{ $cid }}_OCSP="{{ $container.Env.ACME_OCSP }}"
|
|
{{- "\n" }}ACME_{{ $cid }}_EAB_KID="{{ $container.Env.ACME_EAB_KID }}"
|
|
{{- "\n" }}ACME_{{ $cid }}_EAB_HMAC_KEY="{{ $container.Env.ACME_EAB_HMAC_KEY }}"
|
|
{{- "\n" }}ZEROSSL_{{ $cid }}_API_KEY="{{ $container.Env.ZEROSSL_API_KEY }}"
|
|
{{- "\n" }}LETSENCRYPT_{{ $cid }}_RESTART_CONTAINER="{{ $container.Env.LETSENCRYPT_RESTART_CONTAINER }}"
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|