@@ -562,7 +562,7 @@ proxy_set_header Proxy "";
562
562
563
563
{{- range $hostname, $vhost := $parsedVhosts }}
564
564
{{- $vhost_data := when (hasKey $globals.vhosts $hostname) (get $globals.vhosts $hostname) (dict) }}
565
- {{- $paths := coalesce $vhost_data.paths (dict) }}
565
+ {{- $paths := $vhost_data.paths | default (dict) }}
566
566
567
567
{{- if (empty $vhost) }}
568
568
{{ $vhost = dict "/" (dict) }}
@@ -572,7 +572,7 @@ proxy_set_header Proxy "";
572
572
{{- if (empty $vpath) }}
573
573
{{- $vpath = dict "dest" "" "port" "default" }}
574
574
{{- end }}
575
- {{- $dest := coalesce $vpath.dest "" }}
575
+ {{- $dest := $vpath.dest | default "" }}
576
576
{{- $port := when (hasKey $vpath "port") (toString $vpath.port) "default" }}
577
577
{{- $path_data := when (hasKey $paths $path) (get $paths $path) (dict) }}
578
578
{{- $path_ports := when (hasKey $path_data "ports") (get $path_data "ports") (dict) }}
@@ -613,12 +613,12 @@ proxy_set_header Proxy "";
613
613
{{- end }}
614
614
615
615
{{- $vhost_data := when (hasKey $globals.vhosts $hostname) (get $globals.vhosts $hostname) (dict) }}
616
- {{- $paths := coalesce $vhost_data.paths (dict) }}
616
+ {{- $paths := $vhost_data.paths | default (dict) }}
617
617
618
618
{{- $tmp_paths := groupByWithDefault $containers "Env.VIRTUAL_PATH" "/" }}
619
619
620
620
{{- range $path, $containers := $tmp_paths }}
621
- {{- $dest := or (first ( groupByKeys $containers "Env.VIRTUAL_DEST")) "" }}
621
+ {{- $dest := groupByKeys $containers "Env.VIRTUAL_DEST" | first | default "" }}
622
622
{{- $port := "legacy" }}
623
623
{{- $path_data := when (hasKey $paths $path) (get $paths $path) (dict) }}
624
624
{{- $path_ports := when (hasKey $path_data "ports") (get $path_data "ports") (dict) }}
@@ -649,12 +649,12 @@ proxy_set_header Proxy "";
649
649
{{- end }}
650
650
651
651
{{- /* Get the VIRTUAL_PROTO defined by containers w/ the same vhost-vpath, falling back to "http". */}}
652
- {{- $proto := trim (or (first ( groupByKeys $vpath_containers "Env.VIRTUAL_PROTO")) "http") }}
652
+ {{- $proto := groupByKeys $vpath_containers "Env.VIRTUAL_PROTO" | first | default "http" | trim }}
653
653
{{- /* Get the NETWORK_ACCESS defined by containers w/ the same vhost, falling back to "external". */}}
654
- {{- $network_tag := or (first ( groupByKeys $vpath_containers "Env.NETWORK_ACCESS")) "external" }}
654
+ {{- $network_tag := groupByKeys $vpath_containers "Env.NETWORK_ACCESS" | first | default "external" }}
655
655
656
- {{- $loadbalance := first (keys ( groupByLabel $vpath_containers "com.github.nginx-proxy.nginx-proxy.loadbalance")) }}
657
- {{- $keepalive := coalesce (first (keys ( groupByLabel $vpath_containers "com.github.nginx-proxy.nginx-proxy.keepalive"))) "disabled" }}
656
+ {{- $loadbalance := groupByLabel $vpath_containers "com.github.nginx-proxy.nginx-proxy.loadbalance" | keys | first }}
657
+ {{- $keepalive := groupByLabel $vpath_containers "com.github.nginx-proxy.nginx-proxy.keepalive" | keys | first | default "disabled" }}
658
658
659
659
{{- $upstream := $vhost_data.upstream_name }}
660
660
{{- if (not (eq $path "/")) }}
@@ -672,14 +672,14 @@ proxy_set_header Proxy "";
672
672
{{ $vhost_containers = concat $vhost_containers $vpath_containers }}
673
673
{{- end }}
674
674
675
- {{- $certName := first ( groupByKeys $vhost_containers "Env.CERT_NAME") }}
675
+ {{- $certName := groupByKeys $vhost_containers "Env.CERT_NAME" | first }}
676
676
{{- $vhostCert := closest (dir "/etc/nginx/certs") (printf "%s.crt" $hostname) }}
677
677
{{- $vhostCert = trimSuffix ".crt" $vhostCert }}
678
678
{{- $vhostCert = trimSuffix ".key" $vhostCert }}
679
679
{{- $cert := or $certName $vhostCert }}
680
680
{{- $cert_ok := and (ne $cert "") (exists (printf "/etc/nginx/certs/%s.crt" $cert)) (exists (printf "/etc/nginx/certs/%s.key" $cert)) }}
681
681
682
- {{- $enable_debug_endpoint := coalesce ( groupByLabel $vhost_containers "com.github.nginx-proxy.nginx-proxy.debug-endpoint" | keys | first) $globals.config.enable_debug_endpoint | parseBool }}
682
+ {{- $enable_debug_endpoint := groupByLabel $vhost_containers "com.github.nginx-proxy.nginx-proxy.debug-endpoint" | keys | first | default $globals.config.enable_debug_endpoint | parseBool }}
683
683
{{- $default := eq $globals.config.default_host $hostname }}
684
684
{{- $https_method := groupByKeys $vhost_containers "Env.HTTPS_METHOD" | first | default $globals.config.https_method }}
685
685
{{- $enable_http_on_missing_cert := groupByKeys $vhost_containers "Env.ENABLE_HTTP_ON_MISSING_CERT" | first | default $globals.config.enable_http_on_missing_cert | parseBool }}
@@ -697,16 +697,16 @@ proxy_set_header Proxy "";
697
697
{{- end }}
698
698
699
699
{{- /* Get the SERVER_TOKENS defined by containers w/ the same vhost, falling back to "". */}}
700
- {{- $server_tokens := trim (or (first ( groupByKeys $vhost_containers "Env.SERVER_TOKENS")) "") }}
700
+ {{- $server_tokens := groupByKeys $vhost_containers "Env.SERVER_TOKENS" | first | default "" | trim }}
701
701
702
702
{{- /* Get the SSL_POLICY defined by containers w/ the same vhost, falling back to empty string (use default). */}}
703
- {{- $ssl_policy := or (first ( groupByKeys $vhost_containers "Env.SSL_POLICY")) "" }}
703
+ {{- $ssl_policy := groupByKeys $vhost_containers "Env.SSL_POLICY" | first | default "" }}
704
704
705
705
{{- /* Get the HSTS defined by containers w/ the same vhost, falling back to "max-age=31536000". */}}
706
706
{{- $hsts := groupByKeys $vhost_containers "Env.HSTS" | first | default $globals.config.hsts }}
707
707
708
708
{{- /* Get the VIRTUAL_ROOT By containers w/ use fastcgi root */}}
709
- {{- $vhost_root := or (first ( groupByKeys $vhost_containers "Env.VIRTUAL_ROOT")) "/var/www/public" }}
709
+ {{- $vhost_root := groupByKeys $vhost_containers "Env.VIRTUAL_ROOT" | first | default "/var/www/public" }}
710
710
711
711
{{- $vhost_data = merge $vhost_data (dict
712
712
"cert" $cert
0 commit comments