fix: fix issue with multiple domain support for caddy

This commit is contained in:
Jose Diaz-Gonzalez
2022-08-18 10:53:08 -04:00
parent 591fe8642d
commit 741ffc635c
2 changed files with 87 additions and 3 deletions

View File

@@ -75,6 +75,7 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
app_domains="$(plugn trigger domains-list "$APP")"
if [[ -n "$app_domains" ]]; then
caddy_domains="$(echo "$app_domains" | xargs)"
caddy_domains="${caddy_domains// /, }"
fi
# add the labels for caddy here
@@ -100,7 +101,7 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
letsencrypt_email="$(fn-caddy-letsencrypt-email)"
scheme="http"
if [[ -n "$letsencrypt_email" ]] && [[ "$has_443_mapping" == "true" ]]; then
output="--label caddy=${caddy_domains}"
output="--label 'caddy=${caddy_domains}'"
scheme="https"
if [[ -z "$proxy_container_https_port" ]]; then
warning_scheme="$(awk -F ':' '{ print $1 }' <<<"$ssl_warning_mapping")"
@@ -111,8 +112,8 @@ trigger-caddy-vhosts-docker-args-process-deploy() {
output="$output --label \"caddy.reverse_proxy={{ upstreams $proxy_container_https_port }}\""
elif [[ -n "$proxy_container_http_port" ]] || [[ -n "$proxy_container_http_port_candidate" ]]; then
caddy_domains="${caddy_domains// /:80 }"
output="--label caddy=${caddy_domains}:80"
caddy_domains="${caddy_domains//, /:80, }"
output="--label 'caddy=${caddy_domains}:80'"
if [[ -z "$proxy_container_http_port" ]]; then
dokku_log_warn "Warning: http:80 port mapping not found"
dokku_log_warn "Utilizing first http port mapping, http:$proxy_host_http_port_candidate:$proxy_container_http_port_candidate"