fix(scripts): Improve base URL configuration display clarity
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

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 <noreply@anthropic.com>
This commit is contained in:
2026-02-01 00:57:23 -06:00
parent 0495c48418
commit 38f22f0b4e

View File

@@ -686,6 +686,48 @@ recalculate_urls() {
fi 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() { port_label() {
local key="$1" local key="$1"
case "$key" in case "$key" in
@@ -882,8 +924,16 @@ configure_base_url() {
current_url=$(get_env_value "MOSAIC_BASE_URL") current_url=$(get_env_value "MOSAIC_BASE_URL")
if [[ -n "$current_url" ]] && ! is_placeholder "$current_url"; then if [[ -n "$current_url" ]] && ! is_placeholder "$current_url"; then
echo "Current base URL: $current_url" # Show detailed breakdown of existing configuration
if [[ "$NON_INTERACTIVE" == true ]] || ! confirm "Change base URL?" "n"; then 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 if parse_base_url "$current_url"; then
BASE_URL_MODE="custom" BASE_URL_MODE="custom"
if [[ -n "$BASE_URL_PORT" ]]; then if [[ -n "$BASE_URL_PORT" ]]; then