From be7c4c8c850fe0e9e3eb863b0d2bf99c819881f4 Mon Sep 17 00:00:00 2001 From: Nicolas Duchon Date: Sun, 5 May 2024 16:31:03 +0200 Subject: [PATCH] fix: do not discard containers without VIRTUAL_PATH For containers grouped by identical VIRTUAL_HOST, those with no VIRTUAL_PATH variable were silently discarded when at least one container with VIRTUAL_PATH existed. --- nginx.tmpl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nginx.tmpl b/nginx.tmpl index a5be0b0..2b73158 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -526,10 +526,7 @@ proxy_set_header Proxy ""; {{- $vhost_data := when (hasKey $globals.vhosts $hostname) (get $globals.vhosts $hostname) (dict) }} {{- $paths := coalesce $vhost_data.paths (dict) }} - {{- $tmp_paths := groupBy $containers "Env.VIRTUAL_PATH" }} - {{- if not (gt (len $tmp_paths) 0) }} - {{- $tmp_paths = dict "/" $containers }} - {{- end }} + {{- $tmp_paths := groupByWithDefault $containers "Env.VIRTUAL_PATH" "/" }} {{- range $path, $containers := $tmp_paths }} {{- $dest := or (first (groupByKeys $containers "Env.VIRTUAL_DEST")) "" }}