Files
erp-nutzfahrzeuge/deploy/env.md
T

57 lines
2.6 KiB
Markdown
Raw Normal View History

# Environment Configuration — ERP Nutzfahrzeuge
**Source:** `backend/.env.example` (safe reference — no live values)
---
## Required Variables
These variables MUST be set before the application can start.
| Variable | Description | Example (redacted) |
|----------|-------------|---------------------|
| `DATABASE_URL` | PostgreSQL async connection string | `postgresql+asyncpg://user:***@host:5432/dbname` |
| `JWT_SECRET` | Secret key for JWT signing (≥256 bits) | `<redacted — generate with openssl rand -hex 32>` |
## Important Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `REDIS_URL` | `redis://localhost:6379/0` | Redis connection for async task queues. Not required for JWT (stateless). Required for OCR/retouch/mobile.de async processing. |
| `JWT_ALGORITHM` | `HS256` | JWT signing algorithm |
| `JWT_ACCESS_TTL_MINUTES` | `15` | Access token TTL in minutes |
| `JWT_REFRESH_TTL_DAYS` | `7` | Refresh token TTL in days |
| `CORS_ORIGINS` | `http://localhost:3000,http://localhost:3001` | Comma-separated allowed origins. Add production frontend URL. |
| `UPLOAD_DIR` | `/tmp/uploads` | File upload directory. **Must be a persistent volume in production.** |
| `APP_NAME` | `ERP Nutzfahrzeuge` | Application display name |
| `APP_ENV` | `development` | Set to `production` for deployment |
## Optional Integration Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `MOBILE_DE_API_KEY` | (empty) | mobile.de API key for vehicle listing push |
| `MOBILE_DE_SELLER_ID` | (empty) | mobile.de seller ID |
| `OPENROUTER_API_KEY` | (not set) | OpenRouter API key for AI Copilot features. Without this, Copilot endpoints will fail. |
| `BZST_API_ENABLED` | `False` | Enable BZSt USt-IdNr. verification API |
## Production Checklist
- [ ] `DATABASE_URL` points to production PostgreSQL (managed or backed up)
- [ ] `JWT_SECRET` is a cryptographically secure random string (not placeholder)
- [ ] `APP_ENV=production`
- [ ] `CORS_ORIGINS` includes production frontend origin
- [ ] `UPLOAD_DIR` points to a persistent volume mount
- [ ] `REDIS_URL` set if async features (OCR, retouch, mobile.de) are needed
- [ ] `OPENROUTER_API_KEY` set if AI Copilot is needed
- [ ] `MOBILE_DE_API_KEY` and `MOBILE_DE_SELLER_ID` set if mobile.de integration is needed
## Coolify Configuration
In Coolify, set these as environment variables (or via `.env` file in the resource):
1. Navigate to resource → Environment Variables
2. Add each variable with its production value
3. Redeploy after changes
**Never commit real secret values to the repository.** Use Coolify's secret management or an external secrets manager.