Skip to content

Application Configuration

All backend settings are read from environment variables at startup. Frontend settings are compiled in at build time.

Backend Environment Variables

Server

VariableDefaultDescription
PORT8080HTTP listen port
HOST0.0.0.0Bind address
ENVIRONMENTdevelopmentRuntime environment: development, staging, production
DEV_MODEtrueEnables dev-specific behaviour (set false in production)

PostgreSQL

VariableDefaultDescription
POSTGRES_HOSTlocalhostDatabase host
POSTGRES_PORT5432Database port
POSTGRES_DBslozy_devDatabase name
POSTGRES_USERslozy_userDatabase user
POSTGRES_PASSWORD(empty)Database password
POSTGRES_SSL_MODEdisableSSL mode (disable, require, verify-full)

Connection Pooling

VariableDefaultDescription
POSTGRES_MAX_OPEN_CONNS25Maximum open connections to the database
POSTGRES_MAX_IDLE_CONNS10Maximum idle connections in the pool
POSTGRES_CONN_MAX_LIFETIME1hMaximum lifetime of a connection
POSTGRES_CONN_MAX_IDLETIME10mMaximum idle time before a connection is closed

Redis

VariableDefaultDescription
REDIS_HOSTlocalhostRedis host
REDIS_PORT6379Redis port
REDIS_PASSWORD(empty)Redis password
REDIS_DB0Redis database number
REDIS_TLS_ENABLEDfalseEnable TLS for Redis connection

JWT

VariableDefaultDescription
JWT_SECRETdev_change_me_in_production_min_32_charsHMAC signing key for JWT tokens
JWT_EXPIRATION8hToken lifetime (Go duration format)

CORS

VariableDefaultDescription
CORS_ENABLEDtrueEnable CORS headers
CORS_ORIGINShttp://localhost:3000,http://localhost:8080Comma-separated allowed origins

Logging

VariableDefaultDescription
LOG_LEVELinfoLog level: debug, info, warn, error
LOG_FORMATjsonOutput format: json or text

Rate Limiting

VariableDefaultDescription
RATE_LIMIT_REQUESTS_PER_SECOND10Global API rate limit
RATE_LIMIT_SLO_CREATES_PER_SECOND5Stricter limit for SLO creation

Ingestion Worker

VariableDefaultDescription
INGESTION_INTERVAL60sInterval between Prometheus metric ingestion cycles
INGESTION_TIMEOUT30sTimeout per ingestion cycle
MAX_CONCURRENT_QUERIES50Maximum concurrent Prometheus queries

Metrics

VariableDefaultDescription
METRICS_ENABLEDtrueExpose /metrics endpoint for Prometheus
METRICS_PORT9090Port for the metrics HTTP server

Frontend Environment Variables

Set these in frontend/.env.production or pass them when building the Docker image.

VariableDefaultDescription
VITE_API_URL/api/v1API path prefix (proxied through Vite dev server)
VITE_API_BASE_URLhttp://localhost:8080Backend 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=json

For Kubernetes deployments, inject these via Secrets or a secretProviderClass (e.g. AWS Secrets Manager, Vault).