Environment Variables¶
This page documents all environment variables used by the application and how to manage them securely across environments.
Variables Reference¶
| Variable | Required | Default | Description |
|---|---|---|---|
OPENAI_API_KEY |
✅ Yes | — | Your OpenAI API key. Application will raise a ValueError on startup if missing. |
DATABASE_URL |
❌ No | dbn-poc-database.db |
Path to the SQLite database file. Relative or absolute. |
VANNA_MODEL |
❌ No | gpt-4o |
The OpenAI model passed to Vanna. Use gpt-4o-mini for a cost-optimised option. |
APP_NAME |
❌ No | DBN Analytics POC API |
API title displayed in the Swagger UI header. |
Local Development¶
Create a .env file in the project root:
Never commit .env
The .gitignore and .dockerignore files both exclude .env. Verify this before pushing to a public repository.
Production (Fly.io)¶
On Fly.io, secrets are injected into the container at runtime. They are encrypted at rest and never exposed in image layers.
Set a secret:
View all set secrets (names only, not values):
Remove a secret:
Docker (--env flag)¶
When running the Docker image locally:
docker run -p 8080:8080 \
-e OPENAI_API_KEY="sk-proj-..." \
-e VANNA_MODEL="gpt-4o-mini" \
dbn-analytics-poc
Or use a --env-file: