Skip to content
This repository was archived by the owner on Nov 5, 2022. It is now read-only.

Commit f394596

Browse files
committed
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.
1 parent e36e38f commit f394596

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nginx.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ upstream {{ $host }} {
9494
{{ $default_server := index (dict $host "" $default_host "default_server") $host }}
9595

9696
{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost, falling back to "http" */}}
97-
{{ $proto := or (trim (first (groupByKeys $containers "Env.VIRTUAL_PROTO"))) "http" }}
97+
{{ $proto := trim (or (first (groupByKeys $containers "Env.VIRTUAL_PROTO")) "http") }}
9898

9999
{{/* Get the first cert name defined by containers w/ the same vhost */}}
100100
{{ $certName := (first (groupByKeys $containers "Env.CERT_NAME")) }}

0 commit comments

Comments
 (0)