diff --git a/app/letsencrypt_service_data.tmpl b/app/letsencrypt_service_data.tmpl index 3ef4fe1e..456e6ad7 100644 --- a/app/letsencrypt_service_data.tmpl +++ b/app/letsencrypt_service_data.tmpl @@ -3,11 +3,13 @@ LETSENCRYPT_CONTAINERS=( {{ 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 }}' {{ end }} {{ end }} @@ -18,6 +20,7 @@ LETSENCRYPT_CONTAINERS=( {{ range $hosts, $containers := groupBy $ "Env.LETSENCRYPT_HOST" }} {{ $hosts := trimSuffix "," $hosts }} {{ range $container := $containers }} + {{/* Trim spaces and set empty values on per-container environment variables */}} {{ $KEYSIZE := trim (coalesce $container.Env.LETSENCRYPT_KEYSIZE "") }} {{ $STAGING := trim (coalesce $container.Env.LETSENCRYPT_TEST "") }} {{ $EMAIL := trim (coalesce $container.Env.LETSENCRYPT_EMAIL "") }} @@ -30,6 +33,7 @@ LETSENCRYPT_CONTAINERS=( {{ $RESTART_CONTAINER := trim (coalesce $container.Env.LETSENCRYPT_RESTART_CONTAINER "") }} {{ $cid := printf "%.12s" $container.ID }} {{ if parseBool (coalesce $container.Env.LETSENCRYPT_SINGLE_DOMAIN_CERTS "false") }} + {{/* Explicit per-domain splitting of the certificate */}} {{ range $host := split $hosts "," }} {{ $host := trim $host }} {{ $host := trimSuffix "." $host }} @@ -47,6 +51,7 @@ LETSENCRYPT_CONTAINERS=( {{- "\n" }}LETSENCRYPT_{{ $cid }}_{{ $hostHash }}_RESTART_CONTAINER="{{ $RESTART_CONTAINER }}" {{ end }} {{ else }} + {{/* Default: multi-domain (SAN) certificate */}} {{- "\n" }}LETSENCRYPT_{{ $cid }}_HOST=( {{- range $host := split $hosts "," }} {{- $host := trim $host }}