Use 'or' function instead of replacing an already defined variable
This commit is contained in:
parent
e583285351
commit
cecac88a71
1 changed files with 1 additions and 4 deletions
|
@ -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 }}
|
||||
|
|
Loading…
Reference in a new issue