Avoid type error with trim

`first` returns interface{}, not string, so it makes strings.Trim choke. The
call to `or` returns a string in both cases, which `trim` can handle.
This commit is contained in:
Mike Dillon 2015-10-19 14:20:33 -07:00
parent e36e38f166
commit f394596806

View file

@ -94,7 +94,7 @@ upstream {{ $host }} {
{{ $default_server := index (dict $host "" $default_host "default_server") $host }}
{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost, falling back to "http" */}}
{{ $proto := or (trim (first (groupByKeys $containers "Env.VIRTUAL_PROTO"))) "http" }}
{{ $proto := trim (or (first (groupByKeys $containers "Env.VIRTUAL_PROTO")) "http") }}
{{/* Get the first cert name defined by containers w/ the same vhost */}}
{{ $certName := (first (groupByKeys $containers "Env.CERT_NAME")) }}