@@ -3,11 +3,13 @@ LETSENCRYPT_CONTAINERS=(
3
3
{{ if trim $hosts }}
4
4
{{ range $container := $containers }}
5
5
{{ if parseBool (coalesce $container.Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS "false") }}
6
+ {{/* Explicit per-domain splitting of the certificate */}}
6
7
{{ range $host := split $hosts "," }}
7
8
{{ $host := trim $host }}
8
9
{{- "\t"}}'{{ printf "%.12s" $container.ID }}_{{ sha1 $host }}'
9
10
{{ end }}
10
11
{{ else }}
12
+ {{/* Default: multi-domain (SAN) certificate */}}
11
13
{{- "\t"}}'{{ printf "%.12s" $container.ID }}'
12
14
{{ end }}
13
15
{{ end }}
@@ -18,42 +20,55 @@ LETSENCRYPT_CONTAINERS=(
18
20
{{ range $hosts, $containers := groupBy $ "Env.LETSENCRYPT_HOST" }}
19
21
{{ $hosts := trimSuffix "," $hosts }}
20
22
{{ range $container := $containers }}
23
+ {{/* Trim spaces and set empty values on per-container environment variables */}}
24
+ {{ $KEYSIZE := trim (coalesce $container.Env.LETSENCRYPT_KEYSIZE "") }}
25
+ {{ $STAGING := trim (coalesce $container.Env.LETSENCRYPT_TEST "") }}
26
+ {{ $EMAIL := trim (coalesce $container.Env.LETSENCRYPT_EMAIL "") }}
27
+ {{ $CA_URI := trim (coalesce $container.Env.ACME_CA_URI "") }}
28
+ {{ $PREFERRED_CHAIN := trim (coalesce $container.Env.ACME_PREFERRED_CHAIN "") }}
29
+ {{ $OCSP := trim (coalesce $container.Env.ACME_OCSP "") }}
30
+ {{ $EAB_KID := trim (coalesce $container.Env.ACME_EAB_KID "") }}
31
+ {{ $EAB_HMAC_KEY := trim (coalesce $container.Env.ACME_EAB_HMAC_KEY "") }}
32
+ {{ $ZEROSSL_API_KEY := trim (coalesce $container.Env.ZEROSSL_API_KEY "") }}
33
+ {{ $RESTART_CONTAINER := trim (coalesce $container.Env.LETSENCRYPT_RESTART_CONTAINER "") }}
21
34
{{ $cid := printf "%.12s" $container.ID }}
22
35
{{ if parseBool (coalesce $container.Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS "false") }}
36
+ {{/* Explicit per-domain splitting of the certificate */}}
23
37
{{ range $host := split $hosts "," }}
24
38
{{ $host := trim $host }}
25
39
{{ $host := trimSuffix "." $host }}
26
40
{{ $hostHash := sha1 $host }}
27
41
{{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_HOST=('{{ $host }}')
28
- {{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_KEYSIZE="{{ $container.Env.LETSENCRYPT_KEYSIZE }}"
29
- {{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_TEST="{{ $container.Env.LETSENCRYPT_TEST }}"
30
- {{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_EMAIL="{{ $container.Env.LETSENCRYPT_EMAIL }}"
31
- {{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_CA_URI="{{ $container.Env.ACME_CA_URI }}"
32
- {{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_PREFERRED_CHAIN="{{ $container.Env.ACME_PREFERRED_CHAIN }}"
33
- {{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_OCSP="{{ $container.Env.ACME_OCSP }}"
34
- {{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_EAB_KID="{{ $container.Env.ACME_EAB_KID }}"
35
- {{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_EAB_HMAC_KEY="{{ $container.Env.ACME_EAB_HMAC_KEY }}"
36
- {{- "\n" }}ZEROSSL_{{ $cid }}_{{ $hostHash }}_API_KEY="{{ $container.Env. ZEROSSL_API_KEY }}"
37
- {{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_RESTART_CONTAINER="{{ $container.Env.LETSENCRYPT_RESTART_CONTAINER }}"
42
+ {{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_KEYSIZE="{{ $KEYSIZE }}"
43
+ {{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_TEST="{{ $STAGING }}"
44
+ {{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_EMAIL="{{ $EMAIL }}"
45
+ {{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_CA_URI="{{ $CA_URI }}"
46
+ {{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_PREFERRED_CHAIN="{{ $PREFERRED_CHAIN }}"
47
+ {{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_OCSP="{{ $OCSP }}"
48
+ {{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_EAB_KID="{{ $EAB_KID }}"
49
+ {{- "\n" }}ACME_{{ $cid }}_{{ $hostHash }}_EAB_HMAC_KEY="{{ $EAB_HMAC_KEY }}"
50
+ {{- "\n" }}ZEROSSL_{{ $cid }}_{{ $hostHash }}_API_KEY="{{ $ZEROSSL_API_KEY }}"
51
+ {{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_RESTART_CONTAINER="{{ $RESTART_CONTAINER }}"
38
52
{{ end }}
39
53
{{ else }}
54
+ {{/* Default: multi-domain (SAN) certificate */}}
40
55
{{- "\n" }}LETSENCRYPT_{{ $cid }}_HOST=(
41
56
{{- range $host := split $hosts "," }}
42
57
{{- $host := trim $host }}
43
58
{{- $host := trimSuffix "." $host -}}
44
59
'{{ $host }}'{{ " " }}
45
60
{{- end -}}
46
61
)
47
- {{- "\n" }}LETSENCRYPT_{{ $cid }}_KEYSIZE="{{ $container.Env.LETSENCRYPT_KEYSIZE }}"
48
- {{- "\n" }}LETSENCRYPT_{{ $cid }}_TEST="{{ $container.Env.LETSENCRYPT_TEST }}"
49
- {{- "\n" }}LETSENCRYPT_{{ $cid }}_EMAIL="{{ $container.Env.LETSENCRYPT_EMAIL }}"
50
- {{- "\n" }}ACME_{{ $cid }}_CA_URI="{{ $container.Env.ACME_CA_URI }}"
51
- {{- "\n" }}ACME_{{ $cid }}_PREFERRED_CHAIN="{{ $container.Env.ACME_PREFERRED_CHAIN }}"
52
- {{- "\n" }}ACME_{{ $cid }}_OCSP="{{ $container.Env.ACME_OCSP }}"
53
- {{- "\n" }}ACME_{{ $cid }}_EAB_KID="{{ $container.Env.ACME_EAB_KID }}"
54
- {{- "\n" }}ACME_{{ $cid }}_EAB_HMAC_KEY="{{ $container.Env.ACME_EAB_HMAC_KEY }}"
55
- {{- "\n" }}ZEROSSL_{{ $cid }}_API_KEY="{{ $container.Env. ZEROSSL_API_KEY }}"
56
- {{- "\n" }}LETSENCRYPT_{{ $cid }}_RESTART_CONTAINER="{{ $container.Env.LETSENCRYPT_RESTART_CONTAINER }}"
62
+ {{- "\n" }}LETSENCRYPT_{{ $cid }}_KEYSIZE="{{ $KEYSIZE }}"
63
+ {{- "\n" }}LETSENCRYPT_{{ $cid }}_TEST="{{ $STAGING }}"
64
+ {{- "\n" }}LETSENCRYPT_{{ $cid }}_EMAIL="{{ $EMAIL }}"
65
+ {{- "\n" }}ACME_{{ $cid }}_CA_URI="{{ $CA_URI }}"
66
+ {{- "\n" }}ACME_{{ $cid }}_PREFERRED_CHAIN="{{ $PREFERRED_CHAIN }}"
67
+ {{- "\n" }}ACME_{{ $cid }}_OCSP="{{ $OCSP }}"
68
+ {{- "\n" }}ACME_{{ $cid }}_EAB_KID="{{ $EAB_KID }}"
69
+ {{- "\n" }}ACME_{{ $cid }}_EAB_HMAC_KEY="{{ $EAB_HMAC_KEY }}"
70
+ {{- "\n" }}ZEROSSL_{{ $cid }}_API_KEY="{{ $ZEROSSL_API_KEY }}"
71
+ {{- "\n" }}LETSENCRYPT_{{ $cid }}_RESTART_CONTAINER="{{ $RESTART_CONTAINER }}"
57
72
{{ end }}
58
73
{{ end }}
59
74
{{ end }}
0 commit comments