From a84aee4a842afbf0dc9686fce3bd7304358ac55b Mon Sep 17 00:00:00 2001 From: Mike Dillon Date: Sun, 2 Nov 2014 05:23:33 -0800 Subject: [PATCH] Drop unused index variables from range statement --- nginx.tmpl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/nginx.tmpl b/nginx.tmpl index cbe5fe8..fa2a7cb 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -32,9 +32,7 @@ server { {{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }} upstream {{ $host }} { - -{{ range $index, $container := $containers }} - +{{ range $container := $containers }} {{ $addrLen := len $container.Addresses }} {{/* If only 1 port exposed, use that */}} {{ if eq $addrLen 1 }} @@ -42,19 +40,17 @@ upstream {{ $host }} { # {{$container.Name}} server {{ $address.IP }}:{{ $address.Port }}; {{ end }} - {{/* If more than one port exposed, use the one matching VIRTUAL_PORT env var */}} {{ else if $container.Env.VIRTUAL_PORT }} - {{ range $index, $address := $container.Addresses }} + {{ range $address := .Addresses }} {{ if eq $address.Port $container.Env.VIRTUAL_PORT }} # {{$container.Name}} server {{ $address.IP }}:{{ $address.Port }}; {{ end }} {{ end }} - {{/* Else default to standard web port 80 */}} {{ else }} - {{ range $index, $address := $container.Addresses }} + {{ range $address := $container.Addresses }} {{ if eq $address.Port "80" }} # {{$container.Name}} server {{ $address.IP }}:{{ $address.Port }};