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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LQJBvqzXeyuhhAcAA3Q5Wq
This commit is contained in:
Claude
2026-06-28 15:07:07 +00:00
parent c09dd775ea
commit 01979c52f0
2 changed files with 9 additions and 2 deletions
+5 -1
View File
@@ -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 ""