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:
+5
-1
@@ -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 ""
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user