Skip to content

Commit c190589

Browse files
committed
fix: handle most recently created containers first
1 parent 9c2bad4 commit c190589

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

app/letsencrypt_service_data.tmpl

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
LETSENCRYPT_CONTAINERS=(
2-
{{ range $hosts, $containers := groupBy $ "Env.LETSENCRYPT_HOST" }}
3-
{{ if trim $hosts }}
4-
{{ range $container := $containers }}
5-
{{ if parseBool (coalesce $container.Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS "false") }}
6-
{{/* Explicit per-domain splitting of the certificate */}}
7-
{{ range $host := split $hosts "," }}
8-
{{ $host := trim $host }}
9-
{{- "\t"}}'{{ printf "%.12s" $container.ID }}_{{ sha1 $host }}'
10-
{{ end }}
11-
{{ else }}
12-
{{/* Default: multi-domain (SAN) certificate */}}
13-
{{- "\t"}}'{{ printf "%.12s" $container.ID }}'
2+
{{ $orderedContainers := sortObjectsByKeysDesc $ "Created" }}
3+
{{ range $_, $container := whereExist $orderedContainers "Env.LETSENCRYPT_HOST" }}
4+
{{ if trim $container.Env.LETSENCRYPT_HOST }}
5+
{{ if parseBool (coalesce $container.Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS "false") }}
6+
{{/* Explicit per-domain splitting of the certificate */}}
7+
{{ range $host := split $container.Env.LETSENCRYPT_HOST "," }}
8+
{{ $host := trim $host }}
9+
'{{ printf "%.12s" $container.ID }}_{{ sha1 $host }}'
1410
{{ end }}
11+
{{ else }}
12+
{{/* Default: multi-domain (SAN) certificate */}}
13+
{{- "\t"}}'{{ printf "%.12s" $container.ID }}'
1514
{{ end }}
1615
{{ end }}
1716
{{ end }}

0 commit comments

Comments
 (0)