diff --git a/scripts/install.sh b/scripts/install.sh index 7b5dd28..9d1e486 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -117,6 +117,17 @@ if [ -f "$ENV_FILE" ]; then if [[ ! $REPLY =~ ^[Yy]$ ]]; then print_info "Keeping existing configuration." SKIP_CONFIG=true + + # Older installs predate PLATFORM_URL (added when email links moved + # off the dev default) — backfill it from CORS_ORIGINS so upgrading + # in place doesn't break the backend's required-env-var check. + if ! grep -q '^PLATFORM_URL=' "$ENV_FILE" 2>/dev/null; then + EXISTING_ORIGIN=$(grep '^CORS_ORIGINS=' "$ENV_FILE" 2>/dev/null | cut -d= -f2-) + if [ -n "$EXISTING_ORIGIN" ]; then + echo "PLATFORM_URL=${EXISTING_ORIGIN}" >> "$ENV_FILE" + print_info "Added missing PLATFORM_URL=${EXISTING_ORIGIN} to existing .env" + fi + fi fi fi @@ -314,6 +325,10 @@ MINIO_BUCKET=evidence # ── CORS (allowed frontend origins) ───────────────────────────────────────── CORS_ORIGINS=${ORIGIN_URL} +# ── Emails ──────────────────────────────────────────────────────────────────── +# Base URL used to build links in outbound emails (set-password, etc). +PLATFORM_URL=${ORIGIN_URL} + # ── Frontend ───────────────────────────────────────────────────────────────── FRONTEND_PORT=${FRONTEND_PORT}