Skip to content

Commit 4085f64

Browse files
committed
Fix trimming on the docker-gen template
Incorrect trimming did lead to empty domains being created on space separated domains or with comma trailed LETSENCRYPT_HOST environment variable. This in turns led to the container being caught in an endless loop trying to delete /etc/nginx/certs nginx-proxy#254 nginx-proxy#288
1 parent 8bc5177 commit 4085f64

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

app/letsencrypt_service_data.tmpl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ LETSENCRYPT_CONTAINERS=({{ range $hosts, $containers := groupBy $ "Env.LETSENCRY
22

33
{{ range $hosts, $containers := groupBy $ "Env.LETSENCRYPT_HOST" }}
44

5-
{{ if trim $hosts }}
5+
{{ $hosts := trimSuffix "," $hosts }}
66

77
{{ range $container := $containers }}{{ $cid := printf "%.12s" $container.ID }}
8-
LETSENCRYPT_{{ $cid }}_HOST=( {{ range $host := split $hosts "," }}'{{ $host }}' {{ end }})
8+
LETSENCRYPT_{{ $cid }}_HOST=( {{ range $host := split $hosts "," }}{{ $host := trim $host }}'{{ $host }}' {{ end }})
99
LETSENCRYPT_{{ $cid }}_EMAIL="{{ $container.Env.LETSENCRYPT_EMAIL }}"
1010
LETSENCRYPT_{{ $cid }}_KEYSIZE="{{ $container.Env.LETSENCRYPT_KEYSIZE }}"
1111
LETSENCRYPT_{{ $cid }}_TEST="{{ $container.Env.LETSENCRYPT_TEST }}"
1212
{{ end }}
1313

1414
{{ end }}
15-
16-
{{ end }}

0 commit comments

Comments
 (0)