Configuration
All configuration is managed via environment variables in the .env file.
Environment Variables
App
| Variable |
Default |
Description |
APP_NAME |
cms-api |
Application name |
APP_VERSION |
1.0.0 |
Application version |
ENVIRONMENT |
dev |
Environment (dev / prod) |
DEBUG |
False |
Enable SQL query logging |
API_PORT |
8100 |
Exposed API port |
LOG_LEVEL |
INFO |
Logging level |
Database
| Variable |
Default |
Description |
DATABASE_URL |
— |
SQLAlchemy connection string |
POSTGRES_DB |
cms |
Database name |
POSTGRES_USER |
cms |
Database user |
POSTGRES_PASSWORD |
cms |
Database password |
POSTGRES_PORT |
5434 |
Exposed PostgreSQL port |
JWT
| Variable |
Default |
Description |
JWT_SECRET_KEY |
— |
Secret key for signing JWT tokens |
JWT_ALGORITHM |
HS256 |
JWT signing algorithm |
ACCESS_TOKEN_EXPIRE_MINUTES |
15 |
Access token lifetime in minutes |
REFRESH_TOKEN_EXPIRE_DAYS |
14 |
Refresh token lifetime in days |
Danger
JWT_SECRET_KEY must be a strong random string in production.
Generate one with: openssl rand -hex 32
CORS
| Variable |
Default |
Description |
CORS_ORIGINS |
http://localhost:5173,http://localhost:3000 |
Allowed origins (comma-separated) |
Example .env
APP_NAME=cms-api
APP_VERSION=1.0.0
ENVIRONMENT=dev
DEBUG=True
API_PORT=8100
LOG_LEVEL=INFO
DATABASE_URL=postgresql+psycopg://cms:cms@postgres:5432/cms
POSTGRES_DB=cms
POSTGRES_USER=cms
POSTGRES_PASSWORD=cms
POSTGRES_PORT=5434
JWT_SECRET_KEY=your-generated-secret-here
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=15
REFRESH_TOKEN_EXPIRE_DAYS=14
CORS_ORIGINS=http://localhost:5173,http://localhost:3000