Don't overwrite frontend/.env.local in deploy script
- Remove auto-generation of frontend/.env.local - Instead, check that it exists and fail with helpful message if not - Update .env.deploy.example to document manual .env.local setup This allows manual management of frontend credentials without the deploy script overwriting them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
fed9bb26bf
commit
e06dd414c9
2 changed files with 24 additions and 22 deletions
|
|
@ -27,17 +27,14 @@ POSTGRES_DB=modcomms
|
|||
# Examples: /var/www/modcomms-prod, /var/www/modcomms-dev
|
||||
FRONTEND_DEPLOY_DIR=/var/www/html/modcomms
|
||||
|
||||
# Backend URLs (used during frontend build)
|
||||
# These should match your domain/vhost configuration
|
||||
VITE_BACKEND_WS_URL=wss://your-domain.com/ws/analyze
|
||||
VITE_BACKEND_URL=https://your-domain.com
|
||||
|
||||
# CORS origins (should match your frontend domain)
|
||||
# Multiple origins can be comma-separated
|
||||
CORS_ORIGINS=https://your-domain.com
|
||||
|
||||
# Azure AD MSAL Configuration (for Microsoft SSO)
|
||||
# Get these from your Azure AD app registration
|
||||
VITE_AZURE_CLIENT_ID=your_azure_client_id
|
||||
VITE_AZURE_TENANT_ID=your_azure_tenant_id
|
||||
VITE_AZURE_REDIRECT_URI=https://your-domain.com
|
||||
# NOTE: Frontend environment variables (VITE_*) are NOT configured here.
|
||||
# Create frontend/.env.local manually with:
|
||||
# VITE_BACKEND_WS_URL=wss://your-domain.com/ws/analyze
|
||||
# VITE_BACKEND_URL=https://your-domain.com
|
||||
# VITE_AZURE_CLIENT_ID=your_azure_client_id
|
||||
# VITE_AZURE_TENANT_ID=your_azure_tenant_id
|
||||
# VITE_AZURE_REDIRECT_URI=https://your-domain.com
|
||||
|
|
|
|||
29
deploy.sh
29
deploy.sh
|
|
@ -102,18 +102,23 @@ cd frontend
|
|||
# Install dependencies (npm install is idempotent)
|
||||
npm install
|
||||
|
||||
# Create/update .env.local with production URLs and Azure AD config
|
||||
cat > .env.local << EOF
|
||||
# Backend URLs
|
||||
VITE_BACKEND_WS_URL=${VITE_BACKEND_WS_URL:-ws://localhost:8000/ws/analyze}
|
||||
VITE_BACKEND_URL=${VITE_BACKEND_URL:-http://localhost:8000}
|
||||
|
||||
# Azure AD MSAL Configuration
|
||||
VITE_AZURE_CLIENT_ID=${VITE_AZURE_CLIENT_ID:-}
|
||||
VITE_AZURE_TENANT_ID=${VITE_AZURE_TENANT_ID:-}
|
||||
VITE_AZURE_REDIRECT_URI=${VITE_AZURE_REDIRECT_URI:-}
|
||||
EOF
|
||||
echo " Frontend environment configured"
|
||||
# Check that .env.local exists (must be created manually with credentials)
|
||||
if [ ! -f .env.local ]; then
|
||||
echo ""
|
||||
echo "Error: frontend/.env.local not found"
|
||||
echo "Create it manually with your environment-specific values:"
|
||||
echo ""
|
||||
echo " cat > frontend/.env.local << 'EOF'"
|
||||
echo " VITE_BACKEND_WS_URL=wss://your-domain.com/ws/analyze"
|
||||
echo " VITE_BACKEND_URL=https://your-domain.com"
|
||||
echo " VITE_AZURE_CLIENT_ID=your_azure_client_id"
|
||||
echo " VITE_AZURE_TENANT_ID=your_azure_tenant_id"
|
||||
echo " VITE_AZURE_REDIRECT_URI=https://your-domain.com"
|
||||
echo " EOF"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
echo " ✓ .env.local exists"
|
||||
|
||||
npm run build
|
||||
cd "$SCRIPT_DIR"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue