Configuration Reference¶
Who is this page for?
Operators. This is the exhaustive reference for every environment
variable read by app/core/config.py (and a few read elsewhere). For the
why behind the security-related ones, see Security.
How configuration works¶
Settings are a Pydantic
BaseSettingsclass (Configs). Values come from environment variables; a local.envis loaded automatically in development.ENVselects the profile.ENV=testswaps inTestConfigs(SQLite, localhost DB).prod/stageactivate fail-fast validation.Several values are validated at import time - a bad value raises before the app serves a single request (see Fail-fast guards below).
Tip
Copy .env.sample to .env and edit. In production, inject values
through the environment or a secret manager - do not ship a .env
with real secrets.
Core / application¶
Variable |
Default |
Notes |
|---|---|---|
|
|
One of |
|
|
ASGI root path when mounted behind a path prefix. |
|
|
API base path. All documented routes are relative to this. |
|
|
Display name. |
|
|
Free-form app version label. |
|
|
Root log level (read in |
|
|
Expose Prometheus |
Database¶
Variable |
Default |
Notes |
|---|---|---|
|
|
SQLAlchemy dialect. |
|
(unset) |
Credentials. |
|
(unset) |
Hostname. |
|
|
Defaults to PostgreSQL’s port (the prior |
|
env-dependent |
Required in ``prod``/``stage`` (boot blocks if unset). Defaults to
|
|
derived |
Assembled from the parts above; usually not set directly. |
Connection pool¶
Variable |
Default |
Notes |
|---|---|---|
|
|
Log every SQL statement. Dev only. |
|
|
Health-check a connection before use (avoids stale-connection errors). |
|
|
Persistent pooled connections. |
|
|
Extra connections allowed above the pool size under burst. |
|
|
Wait time for a free connection before erroring. |
|
|
Recycle connections older than this (dodges server-side idle timeouts). |
Authentication (Keycloak)¶
Variable |
Default |
Notes |
|---|---|---|
|
|
Public realm base URL (used for issuer + token URLs). |
|
|
In-cluster URL used to fetch the JWKS signing keys. |
|
|
Realm name. |
|
|
Required JWT |
|
|
OAuth client id (also used by Swagger UI’s OAuth flow). |
|
(dev placeholder) |
Boot blocks in ``prod``/``stage`` if missing or left at the shipped placeholder. |
|
|
Signs simulation payloads. Boot blocks in ``prod``/``stage`` if
empty. (Historically defaulted to the truthy string |
Security: CORS & proxies¶
Variable |
Default |
Notes |
|---|---|---|
|
|
Plain comma-separated allow-list (not JSON), e.g.
|
|
|
Comma-separated IPs/CIDRs allowed to set |
Abuse prevention & rate limiting¶
Variable |
Default |
Notes |
|---|---|---|
|
|
Master switch for rate limiting on sensitive endpoints. |
|
|
Short-window length. |
|
|
Max requests per key per window. |
|
|
Max requests per source IP per window. |
|
|
Max requests per external user per window. |
|
|
Daily quota per key for sensitive operations. |
|
|
|
DSL engine limits¶
Variable |
Default |
Notes |
|---|---|---|
|
|
Wall-clock backstop per custom-strategy call. |
|
|
Max AST nodes (rejected at validation + runtime). |
|
|
Max recursion depth. |
DSL execution logging¶
Variable |
Default |
Notes |
|---|---|---|
|
|
Persist sampled execution traces. |
|
|
Fraction of successful runs persisted (errors are always kept).
|
|
|
Max trace entries per row (tail-truncated). |
|
|
Bounded background-write queue; overflow drops rows (counted by
|
Errors & extras¶
Variable |
Default |
Notes |
|---|---|---|
|
(unset) |
Enables Sentry when set. |
|
|
Sentry environment tag. |
|
|
Sentry release tag. |
|
(unset) |
Adds an extra server entry to the OpenAPI schema (handy when the API is reachable at more than one base URL). |
|
|
Default points-per-coin used when creating wallets. |
|
(unset) |
Used by this documentation site’s theme only. |
Pagination defaults¶
Variable |
Default |
Notes |
|---|---|---|
|
|
Default page for list endpoints. |
|
|
Default page size ( |
|
|
Default sort ( |
Fail-fast guards (summary)¶
These turn misconfiguration into a loud startup failure in prod/stage:
Variable |
Boot blocks when… |
|---|---|
|
empty |
|
missing or equal to the dev placeholder |
|
unset |
|
set to |
|
contains a malformed IP/CIDR (any environment) |
Minimal production .env skeleton¶
ENV=prod
SECRET_KEY=<from-secret-manager>
DB_ENGINE=postgresql
DB_USER=<user>
DB_PASSWORD=<from-secret-manager>
DB_HOST=<host>
DB_PORT=5432
DB_NAME=<explicit-db-name>
KEYCLOAK_URL=https://auth.example.com
KEYCLOAK_URL_DOCKER=https://auth.example.com
KEYCLOAK_REALM=game
KEYCLOAK_AUDIENCE=account
KEYCLOAK_CLIENT_ID=game-api
KEYCLOAK_CLIENT_SECRET=<from-secret-manager>
BACKEND_CORS_ORIGINS=https://app.example.com,https://admin.example.com
TRUSTED_PROXY_IPS=10.0.0.0/8
ABUSE_PREVENTION_ENABLED=true
ABUSE_PREVENTION_BACKEND=redis
APIKEY_CACHE_BACKEND=redis
REDIS_URL=redis://redis:6379/0
METRICS_ENABLED=false # or keep true and block /metrics at the ingress