Drop unused index variables from range statement
This commit is contained in:
parent
3414a02edf
commit
a84aee4a84
1 changed files with 3 additions and 7 deletions
10
nginx.tmpl
10
nginx.tmpl
|
@ -32,9 +32,7 @@ server {
|
||||||
|
|
||||||
{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}
|
{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}
|
||||||
upstream {{ $host }} {
|
upstream {{ $host }} {
|
||||||
|
{{ range $container := $containers }}
|
||||||
{{ range $index, $container := $containers }}
|
|
||||||
|
|
||||||
{{ $addrLen := len $container.Addresses }}
|
{{ $addrLen := len $container.Addresses }}
|
||||||
{{/* If only 1 port exposed, use that */}}
|
{{/* If only 1 port exposed, use that */}}
|
||||||
{{ if eq $addrLen 1 }}
|
{{ if eq $addrLen 1 }}
|
||||||
|
@ -42,19 +40,17 @@ upstream {{ $host }} {
|
||||||
# {{$container.Name}}
|
# {{$container.Name}}
|
||||||
server {{ $address.IP }}:{{ $address.Port }};
|
server {{ $address.IP }}:{{ $address.Port }};
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{/* If more than one port exposed, use the one matching VIRTUAL_PORT env var */}}
|
{{/* If more than one port exposed, use the one matching VIRTUAL_PORT env var */}}
|
||||||
{{ else if $container.Env.VIRTUAL_PORT }}
|
{{ else if $container.Env.VIRTUAL_PORT }}
|
||||||
{{ range $index, $address := $container.Addresses }}
|
{{ range $address := .Addresses }}
|
||||||
{{ if eq $address.Port $container.Env.VIRTUAL_PORT }}
|
{{ if eq $address.Port $container.Env.VIRTUAL_PORT }}
|
||||||
# {{$container.Name}}
|
# {{$container.Name}}
|
||||||
server {{ $address.IP }}:{{ $address.Port }};
|
server {{ $address.IP }}:{{ $address.Port }};
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{/* Else default to standard web port 80 */}}
|
{{/* Else default to standard web port 80 */}}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ range $index, $address := $container.Addresses }}
|
{{ range $address := $container.Addresses }}
|
||||||
{{ if eq $address.Port "80" }}
|
{{ if eq $address.Port "80" }}
|
||||||
# {{$container.Name}}
|
# {{$container.Name}}
|
||||||
server {{ $address.IP }}:{{ $address.Port }};
|
server {{ $address.IP }}:{{ $address.Port }};
|
||||||
|
|
Reference in a new issue