mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-02-24 01:38:15 +00:00
fix: Sort networks and ports before iterating
This avoids unnecessary nginx restarts caused by config file churn.
This commit is contained in:
parent
6f2a549ef1
commit
37134c44d7
@ -21,7 +21,7 @@
|
||||
{{- $_ := set $globals "ssl_policy" (or ($globals.Env.SSL_POLICY) "Mozilla-Intermediate") }}
|
||||
{{- $_ := set $globals "networks" (dict) }}
|
||||
# networks available to nginx-proxy:
|
||||
{{- range $globals.CurrentContainer.Networks }}
|
||||
{{- range sortObjectsByKeysAsc $globals.CurrentContainer.Networks "Name" }}
|
||||
{{- $_ := set $globals.networks .Name . }}
|
||||
# {{ .Name }}
|
||||
{{- end }}
|
||||
@ -81,7 +81,7 @@
|
||||
*/}}
|
||||
{{- define "container_port" }}
|
||||
{{- /* If only 1 port exposed, use that as a default, else 80. */}}
|
||||
# exposed ports:{{ range $.container.Addresses }} {{ .Port }}/{{ .Proto }}{{ else }} (none){{ end }}
|
||||
# exposed ports:{{ range sortObjectsByKeysAsc $.container.Addresses "Port" }} {{ .Port }}/{{ .Proto }}{{ else }} (none){{ end }}
|
||||
{{- $default_port := when (eq (len $.container.Addresses) 1) (first $.container.Addresses).Port "80" }}
|
||||
# default port: {{ $default_port }}
|
||||
{{- $port := or $.container.Env.VIRTUAL_PORT $default_port }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user