Files
roa2web-service-auto/backend/QUICK-ENV-REFERENCE.md
Claude Agent b137e80b71 feat: multi-Oracle server support with runtime switching
Complete implementation of multi-server Oracle database support:

Backend:
- Multi-pool Oracle with lazy loading per server
- Email-to-server cache for automatic server discovery
- JWT tokens include server_id claim
- /auth/check-identity and /auth/check-email endpoints
- /auth/my-servers endpoint for listing user's accessible servers
- Server switch with password re-authentication

Frontend:
- New ServerSelector component for header dropdown
- Multi-step login flow (identity → server → password)
- Server switching from header with password modal
- Mobile drawer menu with server selection
- Dark mode support for all new components
- URL bookmark support with ?server= query param

Scripts:
- Unified start.sh replacing start-prod.sh/start-test.sh
- Unified ssh-tunnel.sh with multi-server support
- Updated status.sh for new architecture

Tests:
- E2E tests for multi-server and single-server login flows
- Backend unit tests for all new endpoints
- Oracle multi-pool integration tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 22:39:06 +00:00

2.7 KiB

Quick Environment Reference

🔒 SECURITY FIRST

All .env* files (except .env*.example) contain real credentials and are NEVER committed to git!

🚀 First-Time Setup

# 1. Copy template with real credentials
cp backend/.env.prod.example backend/.env.prod

# 2. Edit with YOUR credentials
vim backend/.env.prod

# 3. Fill in the placeholders:
#    - ORACLE_PASSWORD
#    - JWT_SECRET_KEY
#    - AUTH_SESSION_SECRET
#    - TELEGRAM_BOT_TOKEN
#    - SMTP_PASSWORD

# 4. Start production
./start.sh prod

📋 Daily Usage

# Production (uses .env.prod automatically)
./start.sh prod

# Test Environment (uses .env.test automatically)
./start.sh test

# Quick Restart (uses existing .env)
./start-backend.sh restart

✏️ Changing Configuration

# 1. Edit the source file (NOT .env!)
vim backend/.env.prod    # Production
vim backend/.env.test   # Test

# 2. Restart to apply changes
./start.sh prod

📁 Which File to Edit?

You Want To... Edit This File
Change dev database password backend/.env.prod
Update test server settings backend/.env.test
Add new environment variable Templates: .env*.example + your .env.prod/.env.test
Create production config Copy .env.prod.example to .env.prod and fill secrets

🔑 Generating Secrets

# For JWT_SECRET_KEY and AUTH_SESSION_SECRET
python3 -c "import secrets; print(secrets.token_urlsafe(32))"

Generate DIFFERENT secrets for each environment (dev, test, prod)!

⚠️ Important

  • Never edit backend/.env directly (it's auto-generated!)
  • Always edit backend/.env.prod or .env.test
  • Never commit .env, .env.prod, .env.test, .env.prod
  • Only commit .env*.example (templates with placeholders)
  • Restart after changes for them to take effect

🛡️ Git Behavior

File Git Status Contains
.env.prod.example Committed Template (placeholders)
.env.test.example Committed Template (placeholders)
.env.prod.example Committed Template (placeholders)
.env.example Committed Generic template
.env.prod Ignored Real dev credentials
.env.test Ignored Real test credentials
.env.prod Ignored Real prod credentials
.env Ignored Auto-generated (current)

Quick Check

# See what git will commit
git status backend/.env*

# Should show ONLY .env*.example files
# If .env.prod or .env.test appear, they're NOT properly ignored!

📖 More Info

See backend/ENV-SETUP.md for complete documentation.