From 38f22f0b4eab9d0a681344bfafe208a6329aea86 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Sun, 1 Feb 2026 00:57:23 -0600 Subject: [PATCH] fix(scripts): Improve base URL configuration display clarity When detecting existing configuration, the setup script now shows a detailed breakdown instead of just "Current base URL: ...": Mode: Traefik reverse proxy Web URL: https://app.mosaicstack.dev API URL: https://api.mosaicstack.dev Auth: https://auth.mosaicstack.dev This makes it clear: - What access mode is configured (localhost/IP/domain/Traefik) - What each URL is used for (Web UI, API, Authentication) - Whether to change the configuration Added helper functions: - detect_access_mode(): Determines mode from existing .env values - display_access_config(): Formats the URL breakdown display Co-Authored-By: Claude Opus 4.5 --- scripts/setup.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 53ef1f4..394238b 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -686,6 +686,48 @@ recalculate_urls() { fi } +# Detect access mode from existing configuration +detect_access_mode() { + local base_url="$1" + local traefik_mode + traefik_mode=$(get_env_value "TRAEFIK_MODE") + + if [[ "$traefik_mode" == "bundled" || "$traefik_mode" == "upstream" ]]; then + echo "traefik" + elif [[ "$base_url" == *"localhost"* ]]; then + echo "localhost" + elif [[ "$base_url" =~ ^https?://[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ ]]; then + echo "ip" + else + echo "domain" + fi +} + +# Display existing access configuration +display_access_config() { + local web_url="$1" + local api_url="$2" + local auth_url="$3" + local mode="$4" + + local mode_label + case "$mode" in + localhost) mode_label="Localhost development" ;; + ip) mode_label="Local network IP" ;; + domain) mode_label="Custom domain" ;; + traefik) mode_label="Traefik reverse proxy" ;; + *) mode_label="Custom" ;; + esac + + echo "" + echo " Mode: $mode_label" + echo "" + echo " Web URL: $web_url" + [[ -n "$api_url" ]] && echo " API URL: $api_url" + [[ -n "$auth_url" ]] && echo " Auth: $auth_url" + echo "" +} + port_label() { local key="$1" case "$key" in @@ -882,8 +924,16 @@ configure_base_url() { current_url=$(get_env_value "MOSAIC_BASE_URL") if [[ -n "$current_url" ]] && ! is_placeholder "$current_url"; then - echo "Current base URL: $current_url" - if [[ "$NON_INTERACTIVE" == true ]] || ! confirm "Change base URL?" "n"; then + # Show detailed breakdown of existing configuration + local current_api_url current_auth_url detected_mode + current_api_url=$(get_env_value "NEXT_PUBLIC_API_URL") + [[ -z "$current_api_url" ]] && current_api_url=$(get_env_value "API_BASE_URL") + current_auth_url=$(get_env_value "AUTHENTIK_PUBLIC_URL") + detected_mode=$(detect_access_mode "$current_url") + + display_access_config "$current_url" "$current_api_url" "$current_auth_url" "$detected_mode" + + if [[ "$NON_INTERACTIVE" == true ]] || ! confirm "Change access configuration?" "n"; then if parse_base_url "$current_url"; then BASE_URL_MODE="custom" if [[ -n "$BASE_URL_PORT" ]]; then