Configuration
Environment Variables
All Kostrack configuration can be driven by environment variables — useful for containers, CI, and keeping secrets out of code.
Reference
| Variable | Required | Description |
|---|---|---|
KOSTRACK_DSN | Yes* | PostgreSQL DSN for TimescaleDB. Alternative to passing dsn= to configure(). Format: postgresql://user:pass@host/db |
ANTHROPIC_API_KEY | If using Anthropic | Passed through to the underlying Anthropic SDK. |
OPENAI_API_KEY | If using OpenAI | Passed through to the underlying OpenAI SDK. |
GEMINI_API_KEY | If using Gemini | Also checked as GOOGLE_API_KEY. Passed to google-genai SDK. |
TSDB_PASSWORD | Docker Compose | Sets the TimescaleDB password used by docker-compose.yml. |
GRAFANA_PASSWORD | Docker Compose | Sets the Grafana admin password. |
Note
* KOSTRACK_DSN is only required if you don't pass dsn= directly to kostrack.configure().
.env.example
TSDB_PASSWORD=changeme
GRAFANA_PASSWORD=changeme
KOSTRACK_DSN=postgresql://kostrack:changeme@localhost/kostrack
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
GEMINI_API_KEY=AI...
Never commit .env
The .env file is in .gitignore by default. Commit .env.example instead.