From 01979c52f07c1f2631240aa76b430fe3239d5fc9 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 28 Jun 2026 15:07:07 +0000 Subject: [PATCH] fix: SITE_DOMAIN not pre-filling FQDN prompts after wizard Three fixes: 1. configure_caddy_for_service: remove the '!= example.com' filter that silently dropped any valid domain matching that string; now any non-empty SITE_DOMAIN is used as the default subdomain suggestion 2. load_site_config: trim leading/trailing whitespace from key and val so hand-edited .config files with extra spaces still parse correctly 3. setup.sh: call load_site_config after the site wizard saves so the in-memory values are guaranteed fresh for all subsequent service installs Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01LQJBvqzXeyuhhAcAA3Q5Wq --- lib/common.sh | 6 +++++- setup.sh | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/common.sh b/lib/common.sh index 89851cb..351f554 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -66,6 +66,9 @@ load_site_config() { while IFS='=' read -r key val; do [[ "$key" =~ ^[[:space:]]*# ]] && continue [[ -z "${key// }" ]] && continue + # Strip leading/trailing whitespace from both sides so hand-edited files work + key="${key#"${key%%[^[:space:]]*}"}"; key="${key%"${key##*[^[:space:]]}"}" + val="${val#"${val%%[^[:space:]]*}"}"; val="${val%"${val##*[^[:space:]]}"}" case "$key" in SITE_TZ) SITE_TZ="$val" ;; SITE_DOMAIN) SITE_DOMAIN="$val" ;; @@ -328,10 +331,11 @@ configure_caddy_for_service() { # Domain prompt — pre-fill from SITE_DOMAIN when available echo "" local _default_domain="" - if [ -n "$SITE_DOMAIN" ] && [ "$SITE_DOMAIN" != "example.com" ]; then + if [ -n "$SITE_DOMAIN" ]; then _default_domain="${DEFAULT_SUBDOMAIN}.${SITE_DOMAIN}" echo " Default: $_default_domain" else + echo " No base domain set — run: sudo ./setup.sh configure" echo " Examples: ${DEFAULT_SUBDOMAIN}.example.com, ${DEFAULT_SUBDOMAIN}.yourdomain.com" fi echo "" diff --git a/setup.sh b/setup.sh index a534991..cea74e5 100755 --- a/setup.sh +++ b/setup.sh @@ -231,7 +231,10 @@ if ! grep -q '^SITE_TZ=' "$DOCKER_DIR/.config" 2>/dev/null; then echo " and Caddy network for every service — you type them once, not every time." OFFER_CONFIG="" prompt_yn "Configure site defaults now? (y/n):" "y" OFFER_CONFIG - [ "$OFFER_CONFIG" = "y" ] || [ "$OFFER_CONFIG" = "Y" ] && run_site_configure + if [ "$OFFER_CONFIG" = "y" ] || [ "$OFFER_CONFIG" = "Y" ]; then + run_site_configure + load_site_config # reload so subsequent service prompts see the new values + fi fi # 4) Offer Caddy first (most services proxy through it).