Configuration

Environment Variables

All Kostrack configuration can be driven by environment variables — useful for containers, CI, and keeping secrets out of code.

Reference

VariableRequiredDescription
KOSTRACK_DSNYes*PostgreSQL DSN for TimescaleDB. Alternative to passing dsn= to configure(). Format: postgresql://user:pass@host/db
ANTHROPIC_API_KEYIf using AnthropicPassed through to the underlying Anthropic SDK.
OPENAI_API_KEYIf using OpenAIPassed through to the underlying OpenAI SDK.
GEMINI_API_KEYIf using GeminiAlso checked as GOOGLE_API_KEY. Passed to google-genai SDK.
TSDB_PASSWORDDocker ComposeSets the TimescaleDB password used by docker-compose.yml.
GRAFANA_PASSWORDDocker ComposeSets 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.