fix(install): generate PLATFORM_URL in install.sh, backfill on existing .env
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
Fresh installs failed at 'docker compose up' with 'required variable PLATFORM_URL is missing a value' — the install script computes ORIGIN_URL for CORS_ORIGINS already but never wrote PLATFORM_URL, which the backend now requires with no default. Also backfills it into an existing .env (from CORS_ORIGINS) when the user chooses to keep their current config, so upgrading an older install in place doesn't hit the same error.
This commit is contained in:
@@ -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}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user