From cecac88a71af392bbbe21bcb0262399b599a4c73 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Sat, 10 Oct 2015 12:58:18 +0200 Subject: [PATCH] Use 'or' function instead of replacing an already defined variable --- nginx.tmpl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 }}