Skip to content
OBML v1.0
OrionBelt v3.2.0

Configuration

Configuration is via environment variables or a .env file. See .env.template for all options.

Environment Variables

Variable Default Description
LOG_LEVEL INFO Logging level
LOG_FORMAT console console (pretty) or json (structured)
API_SERVER_HOST localhost REST API bind host
API_SERVER_PORT 8000 REST API bind port
PORT — Override port (Cloud Run sets this)
DISABLE_SESSION_LIST false Disable GET /sessions endpoint; a Postgres wire connection then reaches a REST session only by naming its id (database=<session id>, or FROM <session id> on database=orionbelt), and database=orionbelt lists none
SESSION_TTL_SECONDS 1800 Session inactivity timeout (30 min)
SESSION_MAX_AGE_SECONDS 86400 Absolute max session lifetime (24 h)
SESSION_CLEANUP_INTERVAL 60 Cleanup sweep interval (seconds)
MAX_SESSIONS 500 Global concurrent session cap (429 when full)
MAX_MODELS_PER_SESSION 10 Max models a single session may hold
SESSION_RATE_LIMIT 10 Max POST /sessions per IP per minute
TRUSTED_PROXY_COUNT 0 Number of trusted reverse proxies (for X-Forwarded-For)
AUTH_MODE none none, api_key or oidc, for every surface (authentication)
API_KEYS — Comma-separated API keys (32+ characters, high-entropy). Required for api_key; under oidc, service keys
API_KEY_HEADER X-API-Key REST header the key is read from; Authorization: Bearer always works too
OIDC_ISSUER, OIDC_AUDIENCE — Required for oidc: the tokens' issuer and the API's audience (OpenID Connect)
OIDC_JWKS_URI, OIDC_JWKS_FILE from discovery Where the signing keys come from; a file for air-gapped installs
OIDC_JWKS_CACHE_TTL 86400 Seconds before the signing keys are fetched again
OIDC_JWKS_MIN_REFETCH_SECONDS 60 A token with an unknown key fetches the keys again at most this often
OIDC_SCOPE_CLAIMS scope,scp,roles Claims that carry scopes or roles; dot paths reach into objects
OIDC_SCOPE_MAP — IdP names that grant OrionBelt scopes, e.g. analysts=obsl:read
OIDC_CLOCK_SKEW_SECONDS 60 Leeway on token expiry
OIDC_SWAGGER_CLIENT_ID — Public client for signing in on /docs (Swagger UI)
OIDC_SWAGGER_SCOPES openid Scopes /docs asks for at sign-in
OIDC_AUTHORIZATION_ENDPOINT, OIDC_TOKEN_ENDPOINT from discovery The IdP's sign-in and token endpoints; only needed without discovery
TOKEN_STORE_PATH ./tokens/bi_tokens.sqlite Under AUTH_MODE=oidc: the SQLite file of tokens for BI tools, created with the first token; empty turns them off. One OrionBelt process; a persistent volume where the filesystem is not
OIDC_TOKENS_CLIENT_ID — The BI token page's own public client at the IdP (separate from Swagger's), with the redirect URI <API URL>/tokens; unset: no page
OIDC_TOKENS_SCOPES openid Scopes the token page's sign-in asks for, space-separated
TOKEN_DEFAULT_DAYS 90 A new BI token's lifetime when the request names none
TOKEN_MAX_DAYS 365 The longest lifetime a BI token may be created with
OIDC_CLIENT_ID — OrionBelt's own client at the IdP, which asks it for a Snowflake token on a signed-in user's behalf (Snowflake through Entra ID)
OIDC_CLIENT_SECRET, OIDC_CLIENT_SECRET_FILE — That client's secret, or a file holding it; one of them with OIDC_CLIENT_ID
MODEL_FILES — Comma-separated OBML YAML paths for admin-curated mode. Each file is loaded into its own named protected session (addressing name = OBML name: field or filename stem). A single path is fine.
API_BASE_URL — API URL for standalone UI
ROOT_PATH — ASGI root path for UI behind LB
METRICS_ENABLED false Serve Prometheus metrics at /metrics on a port of their own (metrics)
METRICS_HOST 0.0.0.0 Metrics bind address
METRICS_PORT 9090 Metrics port
FLIGHT_ENABLED false Enable Flight SQL + query execution
FLIGHT_PORT 8815 Arrow Flight SQL gRPC port
PGWIRE_ENABLED false Enable PostgreSQL wire-protocol surface (v2.5.0+) — connect any Postgres client (Tableau, DBeaver, Superset, Power BI, psql, Dremio's Postgres source)
PGWIRE_HOST 0.0.0.0 pgwire bind address
PGWIRE_PORT 5432 pgwire TCP port
PGWIRE_AUTH_MODE trust With AUTH_MODE on: SCRAM-SHA-256, or cleartext with password (then use TLS)
PGWIRE_MAX_CONNECTIONS 64 Concurrent connection cap
PGWIRE_QUERY_TIMEOUT_SECONDS 60 Per-query wall-clock timeout
API_TLS_CERT — PEM certificate; with API_TLS_KEY the REST API serves HTTPS (v2.29.0+)
API_TLS_KEY — PEM private key. Both or neither: one alone refuses to start rather than serving plaintext
API_TLS_CLIENT_CA — PEM CA for client certificates; turns on mutual TLS (needs cert + key)
PGWIRE_TLS_CERT — PEM certificate; with the key, pgwire answers S to an SSLRequest and upgrades the socket (v2.28.0+)
PGWIRE_TLS_KEY — PEM private key. Both or neither
PGWIRE_TLS_CLIENT_CA — PEM CA for client certificates; turns on mutual TLS
FLIGHT_TLS_CERT — PEM certificate; with the key, Flight serves grpc+tls instead of grpc (v2.28.0+)
FLIGHT_TLS_KEY — PEM private key. Both or neither
FLIGHT_TLS_CLIENT_CA — PEM CA for client certificates; turns on mutual TLS
QUERY_EXECUTE false true: the REST API runs queries on the configured databases: query execution, OBSQL, one-shot results, rule evaluation, value search, schema inspection. false: it only compiles, and those endpoints answer 503, except oneshot/batch: it answers 200 and marks each query that asks for results with the error QUERY_EXECUTE_DISABLED, while queries that only compile still succeed. FLIGHT_ENABLED turns it on too; pgwire runs queries either way
DB_VENDOR duckdb Database vendor for query execution
DB_POOL_SIZE 5 Idle connections kept per data source
DB_MAX_CONNECTIONS 10 Connections of one data source in use at once, on every surface; 0 for no limit. Queries past it wait in order of arrival
DB_ACQUIRE_TIMEOUT_SECONDS 30 How long a query waits for a connection before DATA_SOURCE_BUSY (503)
DB_KEY_INJECTION_MAX_KEYS by engine Most keys a federated query lists or maps in a fact leg (key injection, key maps), lists and maps together; 0 turns both off. Default 10,000 on Postgres, MySQL, ClickHouse and BigQuery, 1,000 on DuckDB, Snowflake, Databricks and Dremio
DB_TIMEZONE detected IANA zone every data source's sessions run in, unless DB_<NAME>_TIMEZONE says otherwise (data sources); else detected from each session
DUCKDB_INIT_SQL — Statements DuckDB runs once for each instance of a DuckDB source (once while the server runs for a source without a database file; on each query for a database file): CREATE SECRET, ATTACH of an Iceberg catalog, views. Written to run again (IF NOT EXISTS, OR REPLACE); never shown (setup statements)
DUCKDB_CONNECTION_SQL — Statements DuckDB runs on every connection of a DuckDB source: SET search_path, USE, TEMP views; never shown
DUCKDB_MEMORY_LIMIT 50% DuckDB's memory_limit for a DuckDB source, such as 500MB or 50%, of the memory DuckDB sees (a container's limit). Half, not DuckDB's 80%, which leaves the server no room. A source without a database file has one limit for all its queries (memory and spilling)
DUCKDB_ALLOWED_PATHS the database alone Comma-separated directories, files and URL prefixes (s3://bucket/, a catalog's URL) a DuckDB source's queries may read besides its database; * for every path. A MotherDuck database is not limited unless set (what a source may read)
DUCKDB_THREADS every CPU DuckDB's threads for a DuckDB source
DUCKDB_SPILL_DIR see guide Where a DuckDB source spills what outgrows its memory limit; off turns spilling off. Unset, a source without a database file spills under the system's temp directory unless it is in memory, and a database file beside itself
DUCKDB_SPILL_MAX_MB 90% of free disk The most a DuckDB source may spill
OBSL_DATABASES — Comma-separated names of named data sources; each reads DB_<NAME>_TYPE, DB_<NAME>_DESCRIPTION, DB_<NAME>_POOL_SIZE, DB_<NAME>_MAX_CONNECTIONS, DB_<NAME>_ACQUIRE_TIMEOUT_SECONDS, DB_<NAME>_KEY_INJECTION_MAX_KEYS, DB_<NAME>_TIMEZONE and its dialect's variables behind the DB_<NAME>_ prefix. A model picks one with settings.defaultDataSource
DB_<NAME>_AUTH service user: the source logs in as the signed-in caller, by exchanging their identity provider token (Databricks, Snowflake, BigQuery; needs AUTH_MODE=oidc). See logging in as the user
DB_<NAME>_OAUTH_CLIENT_ID — The client a token exchange names, when the vendor's policy needs one (a Databricks service-principal federation policy). Part of the source's identity: two sources that differ only in their client share no token and no cached result
DB_<NAME>_OAUTH_EXCHANGE — Snowflake with AUTH=user: how the IdP is asked for the user's token; entra_obo (Entra ID's on-behalf-of flow) or token_exchange (the standard token exchange, RFC 8693: Okta, Keycloak)
DB_<NAME>_OAUTH_SCOPE — Snowflake with AUTH=user: the scope the token is issued for, e.g. api://<Snowflake app ID>/session:role-any (Entra) or session:role:ANALYST. Part of the source's identity
DB_<NAME>_OAUTH_AUDIENCE — Snowflake with OAUTH_EXCHANGE=token_exchange: the audience asked for (Okta: the authorization server's; Keycloak: the client standing for Snowflake). Part of the source's identity
DB_<NAME>_WORKFORCE_PROVIDER — BigQuery with AUTH=user: the workforce pool provider Google's token service checks the user's token against, //iam.googleapis.com/locations/global/workforcePools/<pool>/providers/<provider> (BigQuery). Part of the source's identity
DB_<NAME>_WORKFORCE_USER_PROJECT BIGQUERY_PROJECT BigQuery with AUTH=user: the project billed for the token exchange. Part of the source's identity
DB_<NAME>_USER_CONNECTION_IDLE_SECONDS 300 For a source with AUTH=user: how long a user's idle connection waits for their next query; never past its warehouse token, never for another user. 0 closes each connection after its query. Each source's own value holds, also for two names that share a connection pool. DB_USER_CONNECTION_IDLE_SECONDS sets it for every source
DB_<NAME>_CACHE_MAX_TTL_SECONDS 300 For a source with AUTH=user: the longest its results stay cached; 0 turns caching off
FEDERATION_MAX_CONCURRENT 4 Queries across data sources running at once per process; the others wait in order of arrival
FEDERATION_QUEUE_TIMEOUT_SECONDS 30 How long a federated query waits for a slot before FEDERATION_BUSY (503)
FEDERATION_LEG_THREADS 16 Legs of federated queries fetched at once per process
FEDERATION_MAX_LEG_ROWS 5000000 Most rows one leg may return; a larger leg is refused with FEDERATION_LEG_TOO_LARGE, which names the joins whose keys make it that large. Held in memory, about 75 MB per million narrow rows (leg size)
FEDERATION_MAX_LEG_MB 512 Most memory one leg may hold, counted as it streams in; a larger leg is refused with FEDERATION_LEG_TOO_LARGE. A leg spilled to disk holds in memory only what the combine step converts (a PostgreSQL numeric read as text becomes a decimal), within this limit, and the spill limits bound the rest
FEDERATION_COMBINE_THREADS 2 DuckDB threads of each federated query's combine step
FEDERATION_COMBINE_MEMORY_LIMIT 512MB DuckDB memory_limit of each combine step
FEDERATION_SPILL_DIR temp directory Directory on real disk where large federated legs are spilled. Unset, the system's temp directory, unless it is in memory (a tmpfs or ramfs, or Cloud Run's filesystem), where every leg stays in memory; off turns spilling off. Not an in-memory filesystem
FEDERATION_SPILL_THRESHOLD_MB 64 A leg past this size goes to a file instead of memory
FEDERATION_SPILL_MAX_MB 4096 Most one federated query may spill; past it, FEDERATION_SPILL_TOO_LARGE
FEDERATION_SPILL_BUDGET_MB 16384 Most the federated queries running at once may spill together; past it, FEDERATION_SPILL_FULL (503)
VALUE_SEARCH_ENABLED true Enable POST /v1/values (dimension-value search; also needs query execution)
VALUE_SEARCH_MAX_LIMIT 200 Most values one value search returns
VALUE_SEARCH_FUZZY_DOMAIN_MAX 10000 Largest number of values a dimension may have for the fuzzy (misspelling) stage
VALUE_SEARCH_TIMEOUT_MS 30000 Wall-clock limit of one value search
COMPILE_CACHE_MAX_ENTRIES 2048 Compiled queries kept in memory, shared by REST, pgwire and Flight (about 7.5 MB at 2048); 0 disables the compilation cache (see endpoints)
COMPILE_CACHE_MAX_BYTES 67108864 Estimated memory cap of the compilation cache (64 MB)
COMPILE_CACHE_MAX_ENTRY_BYTES 1048576 A compiled query larger than this (1 MB) is not cached

Admin-Curated Mode

When MODEL_FILES is set to one or more OBML YAML paths, the server starts in admin-curated mode:

  • Every model file is validated at startup (the server refuses to start if any is invalid)
  • Each model loads into its own named protected session — the addressing name comes from the OBML top-level name: field, falling back to the filename stem
  • Model upload (POST /v1/sessions/{id}/models) and removal (DELETE /v1/sessions/{id}/models/{id}) return 403 Forbidden while the flag is on
  • BI tools select the model via the Flight database header, the pgwire database= URL parameter, or by addressing the named REST routes (POST /v1/sessions/<model_name>/query/semantic-ql)
  • All other endpoints (sessions, query, validate, diagram, etc.) work normally
# One model
MODEL_FILES=./examples/orionbelt_1_commerce.yaml uv run orionbelt-api

# Multiple models, comma-separated
MODEL_FILES=./models/sales.yaml,./models/finance.yaml uv run orionbelt-api

This is the recommended mode for production deployments, BI tool integrations, and AI agents.