mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-02-24 09:48:14 +00:00
Merge pull request #2191 from rhansen/nil-currentcontainer
fix: Don't error if `$globals.CurrentContainer` is `nil`
This commit is contained in:
commit
1f855fc7b3
18
nginx.tmpl
18
nginx.tmpl
@ -20,10 +20,26 @@
|
|||||||
{{- $_ := set $globals "enable_ipv6" (parseBool (coalesce $globals.Env.ENABLE_IPV6 "false")) }}
|
{{- $_ := set $globals "enable_ipv6" (parseBool (coalesce $globals.Env.ENABLE_IPV6 "false")) }}
|
||||||
{{- $_ := set $globals "ssl_policy" (or ($globals.Env.SSL_POLICY) "Mozilla-Intermediate") }}
|
{{- $_ := set $globals "ssl_policy" (or ($globals.Env.SSL_POLICY) "Mozilla-Intermediate") }}
|
||||||
{{- $_ := set $globals "networks" (dict) }}
|
{{- $_ := set $globals "networks" (dict) }}
|
||||||
# networks available to nginx-proxy:
|
# Networks available to the container running docker-gen (which are assumed to
|
||||||
|
# match the networks available to the container running nginx):
|
||||||
|
{{- /*
|
||||||
|
* Note: $globals.CurrentContainer may be nil in some circumstances due to
|
||||||
|
* <https://github.com/nginx-proxy/docker-gen/issues/458>. For more context
|
||||||
|
* see <https://github.com/nginx-proxy/nginx-proxy/issues/2189>.
|
||||||
|
*/}}
|
||||||
|
{{- if $globals.CurrentContainer }}
|
||||||
{{- range sortObjectsByKeysAsc $globals.CurrentContainer.Networks "Name" }}
|
{{- range sortObjectsByKeysAsc $globals.CurrentContainer.Networks "Name" }}
|
||||||
{{- $_ := set $globals.networks .Name . }}
|
{{- $_ := set $globals.networks .Name . }}
|
||||||
# {{ .Name }}
|
# {{ .Name }}
|
||||||
|
{{- else }}
|
||||||
|
# (none)
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
# /!\ WARNING: Failed to find the Docker container running docker-gen. All
|
||||||
|
# upstream (backend) application containers will appear to be
|
||||||
|
# unreachable. Try removing the -only-exposed and -only-published
|
||||||
|
# arguments to docker-gen if you pass either of those. See
|
||||||
|
# <https://github.com/nginx-proxy/docker-gen/issues/458>.
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- /*
|
{{- /*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user