2.7 KiB
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/.envdirectly (it's auto-generated!) - Always edit
backend/.env.prodor.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.