From 02cfe5d65369f5810deaa41dc6f3e5b1fcd04e8b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 22 Sep 2024 01:37:39 -0400 Subject: [PATCH] fix: set multiple hosts via logical operators to conform to new v3 syntax --- .../traefik-vhosts/docker-args-process-deploy | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/plugins/traefik-vhosts/docker-args-process-deploy b/plugins/traefik-vhosts/docker-args-process-deploy index e45b5b18e..1d69e46bc 100755 --- a/plugins/traefik-vhosts/docker-args-process-deploy +++ b/plugins/traefik-vhosts/docker-args-process-deploy @@ -83,8 +83,18 @@ trigger-traefik-vhosts-docker-args-process-deploy() { if [[ -n "$is_app_listening" ]]; then app_domains="$(plugn trigger domains-list "$APP")" if [[ -n "$app_domains" ]]; then - traefik_domains="$(echo "$app_domains" | xargs)" - traefik_domains="${traefik_domains// /\\\`,\\\`}" + # get length of domains + if [[ "$(echo "$traefik_domains" | wc -w)" -eq 1 ]]; then + traefik_domains="Host(\\\`$traefik_domains\\\`)" + else + for domain in $(echo "$app_domains" | xargs); do + if [[ -z "$traefik_domains" ]]; then + traefik_domains="Host(\\\`$domain\\\`)" + continue + fi + traefik_domains="$traefik_domains || Host(\\\`$domain\\\`)" + done + fi fi output="--label traefik.enable=true" @@ -99,7 +109,7 @@ trigger-traefik-vhosts-docker-args-process-deploy() { output="$output --label traefik.http.routers.$APP-$PROC_TYPE-http.entrypoints=$(fn-traefik-http-entry-point)" output="$output --label traefik.http.routers.$APP-$PROC_TYPE-http.service=$APP-$PROC_TYPE-http" if [[ -n "$traefik_domains" ]]; then - output="$output --label \"traefik.http.routers.$APP-$PROC_TYPE-http.rule=Host(\\\`$traefik_domains\\\`)\"" + output="$output --label \"traefik.http.routers.$APP-$PROC_TYPE-http.rule=$traefik_domains\"" fi fi