diff --git a/nginx.tmpl b/nginx.tmpl index 389683c..93d57b5 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -74,10 +74,7 @@ server { upstream {{ $host }} { {{ range $container := $containers }} - {{ $weight := 1 }} - {{ if $container.Env.VIRTUAL_WEIGHT }} - {{ $weight := $container.Env.VIRTUAL_WEIGHT }} - {{end }} + {{ $weight := or ($container.Env.VIRTUAL_WEIGHT) "1" }} {{ $addrLen := len $container.Addresses }} {{/* If only 1 port exposed, use that */}} {{ if eq $addrLen 1 }}