mirror of
https://github.com/nginx-proxy/docker-letsencrypt-nginx-proxy-companion
synced 2024-05-26 12:06:20 +02:00
fix: handle most recently created containers first
This commit is contained in:
parent
9c2bad4532
commit
c190589349
|
@ -1,17 +1,16 @@
|
|||
LETSENCRYPT_CONTAINERS=(
|
||||
{{ range $hosts, $containers := groupBy $ "Env.LETSENCRYPT_HOST" }}
|
||||
{{ if trim $hosts }}
|
||||
{{ range $container := $containers }}
|
||||
{{ if parseBool (coalesce $container.Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS "false") }}
|
||||
{{/* Explicit per-domain splitting of the certificate */}}
|
||||
{{ range $host := split $hosts "," }}
|
||||
{{ $host := trim $host }}
|
||||
{{- "\t"}}'{{ printf "%.12s" $container.ID }}_{{ sha1 $host }}'
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{/* Default: multi-domain (SAN) certificate */}}
|
||||
{{- "\t"}}'{{ printf "%.12s" $container.ID }}'
|
||||
{{ $orderedContainers := sortObjectsByKeysDesc $ "Created" }}
|
||||
{{ range $_, $container := whereExist $orderedContainers "Env.LETSENCRYPT_HOST" }}
|
||||
{{ if trim $container.Env.LETSENCRYPT_HOST }}
|
||||
{{ if parseBool (coalesce $container.Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS "false") }}
|
||||
{{/* Explicit per-domain splitting of the certificate */}}
|
||||
{{ range $host := split $container.Env.LETSENCRYPT_HOST "," }}
|
||||
{{ $host := trim $host }}
|
||||
'{{ printf "%.12s" $container.ID }}_{{ sha1 $host }}'
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{/* Default: multi-domain (SAN) certificate */}}
|
||||
{{- "\t"}}'{{ printf "%.12s" $container.ID }}'
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in New Issue