Application Configuration
All backend settings are read from environment variables at startup. Frontend settings are compiled in at build time.
Backend Environment Variables
Server
| Variable | Default | Description |
|---|---|---|
PORT | 8080 | HTTP listen port |
HOST | 0.0.0.0 | Bind address |
ENVIRONMENT | development | Runtime environment: development, staging, production |
DEV_MODE | true | Enables dev-specific behaviour (set false in production) |
PostgreSQL
| Variable | Default | Description |
|---|---|---|
POSTGRES_HOST | localhost | Database host |
POSTGRES_PORT | 5432 | Database port |
POSTGRES_DB | slozy_dev | Database name |
POSTGRES_USER | slozy_user | Database user |
POSTGRES_PASSWORD | (empty) | Database password |
POSTGRES_SSL_MODE | disable | SSL mode (disable, require, verify-full) |
Connection Pooling
| Variable | Default | Description |
|---|---|---|
POSTGRES_MAX_OPEN_CONNS | 25 | Maximum open connections to the database |
POSTGRES_MAX_IDLE_CONNS | 10 | Maximum idle connections in the pool |
POSTGRES_CONN_MAX_LIFETIME | 1h | Maximum lifetime of a connection |
POSTGRES_CONN_MAX_IDLETIME | 10m | Maximum idle time before a connection is closed |
Redis
| Variable | Default | Description |
|---|---|---|
REDIS_HOST | localhost | Redis host |
REDIS_PORT | 6379 | Redis port |
REDIS_PASSWORD | (empty) | Redis password |
REDIS_DB | 0 | Redis database number |
REDIS_TLS_ENABLED | false | Enable TLS for Redis connection |
JWT
| Variable | Default | Description |
|---|---|---|
JWT_SECRET | dev_change_me_in_production_min_32_chars | HMAC signing key for JWT tokens |
JWT_EXPIRATION | 8h | Token lifetime (Go duration format) |
CORS
| Variable | Default | Description |
|---|---|---|
CORS_ENABLED | true | Enable CORS headers |
CORS_ORIGINS | http://localhost:3000,http://localhost:8080 | Comma-separated allowed origins |
Logging
| Variable | Default | Description |
|---|---|---|
LOG_LEVEL | info | Log level: debug, info, warn, error |
LOG_FORMAT | json | Output format: json or text |
Rate Limiting
| Variable | Default | Description |
|---|---|---|
RATE_LIMIT_REQUESTS_PER_SECOND | 10 | Global API rate limit |
RATE_LIMIT_SLO_CREATES_PER_SECOND | 5 | Stricter limit for SLO creation |
Ingestion Worker
| Variable | Default | Description |
|---|---|---|
INGESTION_INTERVAL | 60s | Interval between Prometheus metric ingestion cycles |
INGESTION_TIMEOUT | 30s | Timeout per ingestion cycle |
MAX_CONCURRENT_QUERIES | 50 | Maximum concurrent Prometheus queries |
Metrics
| Variable | Default | Description |
|---|---|---|
METRICS_ENABLED | true | Expose /metrics endpoint for Prometheus |
METRICS_PORT | 9090 | Port for the metrics HTTP server |
Frontend Environment Variables
Set these in frontend/.env.production or pass them when building the Docker image.
| Variable | Default | Description |
|---|---|---|
VITE_API_URL | /api/v1 | API path prefix (proxied through Vite dev server) |
VITE_API_BASE_URL | http://localhost:8080 | Backend base URL (used in production builds) |
The Vite dev server proxies /api requests to http://localhost:8080 as configured in frontend/vite.config.ts.
Production Checklist
bash
ENVIRONMENT=production
DEV_MODE=false
JWT_SECRET=$(openssl rand -base64 48)
POSTGRES_PASSWORD=<strong-random-password>
CORS_ORIGINS=https://slozy.yourdomain.com
LOG_LEVEL=info
LOG_FORMAT=jsonFor Kubernetes deployments, inject these via Secrets or a secretProviderClass (e.g. AWS Secrets Manager, Vault).