1
+ #! /bin/bash
2
+ # shellcheck disable=SC2034
1
3
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 }}'
14
- {{ end }}
4
+ {{ $orderedContainers := sortObjectsByKeysDesc $ " Created" }}
5
+ {{ range $_ , $container := whereExist $orderedContainers " Env.LETSENCRYPT_HOST" }}
6
+ {{ if trim $container .Env.LETSENCRYPT_HOST }}
7
+ {{ if parseBool (coalesce $container .Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS " false" ) }}
8
+ {{/* Explicit per-domain splitting of the certificate * /}}
9
+ {{ range $host := split $container .Env.LETSENCRYPT_HOST " ," }}
10
+ {{ $host := trim $host }}
11
+ {{- " \n " }}' {{ printf "%.12s" $container.ID }}_{{ sha1 $host }}' # {{ $container.Name }}, created at {{ $container.Created }}
15
12
{{ end }}
13
+ {{ else }}
14
+ {{/* Default: multi-domain (SAN) certificate * /}}
15
+ {{- " \n " }}' {{ printf "%.12s" $container.ID }}' # {{ $container.Name }}, created at {{ $container.Created }}
16
16
{{ end }}
17
17
{{ end }}
18
+ {{ end }}
18
19
)
19
20
20
21
{{ range $hosts , $containers := groupBy $ " Env.LETSENCRYPT_HOST" }}
@@ -34,6 +35,7 @@ LETSENCRYPT_CONTAINERS=(
34
35
{{ $PRE_HOOK := trim (coalesce $container .Env.ACME_PRE_HOOK " " ) }}
35
36
{{ $POST_HOOK := trim (coalesce $container .Env.ACME_POST_HOOK " " ) }}
36
37
{{ $cid := printf " %.12s" $container .ID }}
38
+ {{- " \n" }}# Container {{ $cid }} ({{ $container.Name }})
37
39
{{ if parseBool (coalesce $container .Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS " false" ) }}
38
40
{{/* Explicit per-domain splitting of the certificate * /}}
39
41
{{ range $host := split $hosts " ," }}
0 commit comments