Configuration
{/* GENERATED FILE — do not edit. Produced by docs/scripts/generate-reference.mjs from src/lib/config.ts. */}
All tunable behaviour is environment-driven and centralized in
src/lib/config.ts.
This table is generated from that file, so it cannot drift from the code.
Every variable below and in the next table is validated at server startup;
Startup validation lists which are required
in production and what npm run config:check reports.
| Variable | Type | Default | Purpose |
|---|---|---|---|
DEFAULT_REFRESH_INTERVAL_MS |
number | 15000 |
Default dashboard refresh cadence. A dashboard may override this per its own IR, but new dashboards start from this value. Documented default: 15s. |
MIN_REFRESH_INTERVAL_MS |
number | 2000 |
Minimum refresh cadence enforced server-side to protect the metrics store. |
POLLER_FAILURE_THRESHOLD |
number | 3 |
Consecutive failed executions before the poller stops running a panel on every tick and backs off (#44). |
POLLER_MAX_BACKOFF_MS |
number | 300000 |
The longest the poller waits between attempts at a failing panel (#44). |
DEFAULT_TIME_FROM |
string | now-24h |
Default relative time range applied to new dashboards. Documented default: last 24 hours (“now-24h” .. “now”). |
DEFAULT_TIME_TO |
string | now |
Upper bound of the default range. now keeps new dashboards live. |
MAX_QUERY_ROWS |
number | 5000 |
Hard cap on rows returned by any query executed against the metrics store. |
MAX_RESULT_BYTES |
number | 4 * 1024 * 1024 |
Hard cap on the serialized size (bytes of JSON) of any query result. Rows are a poor proxy for memory; a result over this fails with a 400 naming the limit before it is fully buffered. Default 4 MiB. |
PROMQL_MAX_RANGE |
string | 7d |
The longest range, subquery range or offset a PromQL expression may ask for (#384), so one selector cannot ask the endpoint for a year. A duration such as 7d or 12h. |
LOGQL_MAX_RANGE |
string | str("PROMQL_MAX_RANGE", "7d") |
The longest range or offset a LogQL expression may ask for (#561). Unset, it is PROMQL_MAX_RANGE: one bound on how far back a panel may read. |
MAX_WINDOW_POINTS |
number | 1000 |
Max points retained per series in the browser rolling window. |
QUERY_TIMEOUT_SECONDS |
number | 20 |
Statement timeout (seconds) applied to every metrics query. |
MAX_POOL_PER_SOURCE |
number | 5 |
Most connections this process holds open to any one metrics source (#13). Executions beyond it wait for a free connection, for up to the query timeout plus five seconds. |
CATALOG_STALE_AFTER_DAYS |
number | 30 |
How long a source’s catalog may go without being checked against the live database before it is reported as stale. Stale is a warning, not a refusal — a catalog nobody has refreshed at all is what blocks generation. 0 disables the age check entirely. Documented default: 30 days. |
SHUTDOWN_GRACE_MS |
number | 10000 |
How long the server may take to drain after SIGTERM: pollers stop, SSE subscribers are handed a reconnect hint, in-flight queries are awaited, and the pools are closed. Keep it below the orchestrator’s own kill timeout (terminationGracePeriodSeconds, stop_grace_period) or the process is killed mid-drain. Documented default: 10s. |
SSE_REAUTH_INTERVAL_MS |
number | 60000 |
How often an open dashboard stream verifies its session token again and re-authorizes the dashboard as it is now (#32), so a dashboard deleted or moved out of the viewer’s workspaces stops streaming within this long. A stream also ends at its token’s expiry and on revocation, whatever this is. Documented default: 60s. |
SSE_SLOW_TICKS |
number | 3 |
How many cycles in a row a dashboard stream may stay behind before it is closed with a drop frame (#489): a viewer, or a proxy in front of one, that has stopped reading would otherwise make the server buffer its frames without limit. The browser reconnects after a spread delay and resumes from its last event id. Default 3. |
API_TOKEN_MAX_DAYS |
number | 90 |
The longest a service-account API token may live, in days (#288). Every token has an expiry, and this caps it, so a forgotten one runs out. Documented default: 90. |
AI_MODEL |
string | — |
The AI model id used for generation, surfaced read-only to the UI so users can see which model produced their specs. Empty when unconfigured. This is a display label only — actual provider/model resolution lives in src/lib/ai/provider.ts. |
AI_REQUEST_TIMEOUT_MS |
number | 90000 |
The deadline for one model request, retries and backoff waits included (#22). Keep it below the model-backed routes’ 120s maxDuration, or the platform cuts the response first, with no error. Documented default: 90s, which a whole dashboard from a slower model needs. |
LLM_MAX_IN_FLIGHT |
number | 16 |
Most model calls in flight on this server, across every workspace and model (#496). Past it a call is refused with 429 and a short Retry-After, the same way the per-user rate limit is, rather than every call reaching the provider at once and failing on its rate limit. 0 turns the cap off. Documented default: 16. |
AI_MAX_RETRIES |
number | 2 |
How many times a model request is retried after a transient provider failure (429, 5xx, a dropped connection), with jittered exponential backoff. A 401 or 404 is never retried. 0 disables retrying. Documented default: 2. |
AI_BASE_URL_ALLOWLIST |
string | — |
Hosts and address ranges a model base URL entered in the app (#331) may reach although they are not public, and hosts it may reach over plain http: a local Ollama, a vLLM in the cluster. Comma-separated host names, addresses and CIDR ranges. Empty by default, so an in-app base URL must be public https. The environment’s own OPENAI_BASE_URL is not held to it. |
LOCAL_MODEL_DETECT |
string | auto |
Whether the server looks for a model on the person’s own machine (#607): auto (on when AUTH_MODE=local, off otherwise), on or off. When on, every host in LOCAL_MODEL_ENDPOINTS is reachable by the probe and by the models it finds as if it were in AI_BASE_URL_ALLOWLIST; a base URL typed in the app is still held to AI_BASE_URL_ALLOWLIST alone. |
LOCAL_MODEL_ENDPOINTS |
string | DEFAULT_LOCAL_MODEL_ENDPOINTS |
The OpenAI-style base URLs probed for a model on this machine (#607), comma- or whitespace-separated. The default is Ollama’s and LM Studio’s, from inside a container and outside: http://host.docker.internal:11434/v1, http://localhost:11434/v1, http://host.docker.internal:1234/v1, http://localhost:1234/v1. Ignored unless LOCAL_MODEL_DETECT resolves to on. |
SOURCE_URL_ALLOWLIST |
string | — |
Hosts, addresses and CIDR ranges a Prometheus source’s URL may reach although they are not public, and hosts it may reach over plain http (#385). An in-cluster Prometheus (prometheus.monitoring.svc) is the usual entry. Every workspace’s source admins may point a source at an address listed here, so an endpoint that must stay one tenant’s needs authentication and a granted secret_ref instead. Empty: a source URL must be public https. |
PROMETHEUS_DISCOVERY_WINDOW |
string | 1h |
How far back discovery, refresh and the connection test look for a metric’s series and labels (#386). A duration such as 1h or 6h. |
PROMETHEUS_MIN_STEP_MS |
number | 15000 |
The smallest step a Prometheus range query is sent with (#385). |
PROMQL_MAX_POINTS |
number | 1000 |
The most points per series a Prometheus range query asks for (#385). |
PROMETHEUS_MAX_SERIES |
number | 100 |
The most series one Prometheus result may hold before it is refused as the author’s to narrow (#385). Each series becomes a column. |
LOKI_MAX_ENTRIES |
number | 1000 |
The most log lines one Loki query asks for and keeps (#562): the limit the server sends on every log query, newest first, inside MAX_QUERY_ROWS and a logs panel’s own limit. A cut is said on the panel. |
LOKI_MAX_SERIES |
number | 100 |
The most series one Loki metric query’s result may hold before it is refused as the author’s to narrow (#562), as PROMETHEUS_MAX_SERIES is. |
DUCKDB_SOURCES_DIR |
string | — |
The directory DuckDB sources (#572) may read: an absolute path, under which each source names a directory of Parquet, CSV and JSON files or a .duckdb file. A path that resolves outside it, symlinks included, is refused. Empty (the default) refuses every DuckDB source, so the kind is closed until an operator chooses what it may read. |
DUCKDB_MEMORY_LIMIT |
string | 512MB |
The most memory one DuckDB source’s engine may use, in DuckDB’s own units (512MB, 2GB). Each source has its own engine, so the server’s worst case is this times the DuckDB sources in use. A query that needs more fails with DuckDB’s out-of-memory error, not the process’s. |
DUCKDB_THREADS |
number | 2 |
The threads one DuckDB source’s engine may run a query on. |
DUCKDB_UPLOAD_MAX_BYTES |
number | 50 * 1024 * 1024 |
The largest file, in bytes, a source admin may upload from the browser as a DuckDB source (#595). Streamed to disk under DUCKDB_SOURCES_DIR/uploads and refused, with nothing left behind, past this. |
DUCKDB_UPLOAD_MAX_FILES |
number | 20 |
The most files one upload, and so one uploaded DuckDB source, may hold. |
LLM_RATE_PER_MINUTE |
number | 20 |
Model requests per minute allowed per user in a workspace, on every LLM-backed route (generate, source draft, dashboard chat). A token bucket: this is both the sustained rate and the burst size. 0 disables the limit. Overridable per workspace in the workspace_limits table. |
LLM_DAILY_TOKEN_BUDGET |
number | 2000000 |
Input plus output tokens a workspace may spend per UTC day across every LLM-backed route. Requests over budget get a 429 until midnight UTC. 0 disables the limit. Overridable per workspace in workspace_limits. |
CHAT_HISTORY_MAX_MESSAGES |
number | 100 |
How many messages of one person’s chat history on one dashboard are kept and replayed. The cap is enforced on write and on read, so lowering it takes effect at once. Documented default: 100 messages. |
CHAT_HISTORY_RETENTION_DAYS |
number | 30 |
How long a stored chat message is kept. A conversation is a reader working something out, not a record anyone audits, so it expires. 0 disables the age check and leaves only the message cap. Documented default: 30 days. |
CHAT_CONVERSATIONS_MAX |
number | 200 |
How many Chat conversations (#416) one person keeps. Past it, the one least recently used goes when a new one is started; the two limits above apply within each. Documented default: 200 conversations. |
GENERATION_LOG_RETENTION_DAYS |
number | 30 |
How long a generation_log row – the redacted prompt, the spec the model returned, and what it cost – is kept. The sweep runs on write, so shortening this takes effect at the next generation in that workspace and immediately for anyone reading the log. 0 disables the age check and lets the log grow without bound, which is for an operator shipping the rows somewhere else. Documented default: 30 days. |
RETENTION_SWEEP_INTERVAL_MS |
number | 3600000 |
How often the retention sweep runs (#494), in milliseconds. The generation log, conversations and their messages are also swept when they are written, but a quiet workspace writes nothing, so this sweeps them on a timer too, in bounded batches. Jittered by up to a tenth, so instances started together do not sweep together. 0 turns the timer off. Documented default: 1 hour. |
DASHBOARD_VERSIONS_KEEP |
number | 100 |
How many versions of one dashboard are kept (#494). A save past the cap removes the oldest, never the current one. 0 keeps every version. Documented default: 100. |
MAX_POLLERS |
number | 0 |
Most dashboard pollers one process runs (#495). A stream that would need one more is refused and retried shortly; viewers of a running poller are unaffected. 0 derives it from the heap: half the V8 heap limit (which the Helm chart sets from the memory limit) over about 11 MB a poller. |
OIDC_ACCOUNT_URL |
string | — |
The identity provider’s self-service account page, e.g. Keycloak’s <issuer>/account. The account settings section links to it when set, so people can change the name, email and password the provider owns. Unset hides the link. |
OIDC_MCP_CLIENT_ID |
string | — |
The realm client an MCP client signs in through (#149): a public (PKCE) client beside the confidential one the browser uses, whose access tokens name it in aud and azp. /api/mcp accepts a realm token only when it was minted for this client, and no other route accepts one at all. Unset (the default) keeps /api/mcp closed, and demo mode refuses it like every other OIDC_* variable. |
CSP_REPORT_ONLY |
boolean | false |
Send the Content-Security-Policy as Content-Security-Policy-Report-Only, so the browser logs violations without blocking anything. For rolling the policy out against a deployment; leave false once the console is clean. |
Variables read outside config.ts
Section titled “Variables read outside config.ts”These are read directly from process.env at their point of use rather than
through the config module.
| Variable | Read by | Purpose |
|---|---|---|
DATABASE_URL |
src/lib/db/pg.ts |
Config-store connection string. Required. |
PG_POOL_MAX |
src/lib/db/pg.ts |
Config-store pool size. Defaults to 10. |
SESSION_SECRET |
src/lib/auth/session.ts |
HS256 signing key for first-party session tokens. Must be at least 32 characters in production. |
AI_PROVIDER |
src/lib/ai/provider.ts |
gateway, openai-compatible, or stub (recorded specs for the end-to-end suite; refused in production unless AI_STUB_IN_PRODUCTION=true). |
OPENAI_BASE_URL, OPENAI_API_KEY, OPENAI_API |
src/lib/ai/provider.ts |
OpenAI-compatible endpoint selection. See AI provider. |
AI_GATEWAY_API_KEY |
AI SDK | Used when AI_PROVIDER=gateway. |
OIDC_ISSUER, OIDC_CLIENT_ID, OIDC_CLIENT_SECRET, OIDC_REDIRECT_URI, OIDC_SCOPE |
src/lib/auth/oidc.ts |
OIDC login flow. See Keycloak setup. |
OIDC_JWKS_URL, OIDC_AUDIENCE, OIDC_GROUPS_CLAIM |
src/lib/auth/session.ts |
Token verification and the group claim name. |
SOURCE_SECRET_REFS |
src/lib/secrets/credentials.ts |
Which workspaces may use which secret_ref: REF:ws1,ws2; OTHER:*. Unset grants nothing (an error in production). See Source secret references. |
SOURCE_SECRETS_DIR |
src/lib/secrets/credentials.ts |
Directory of <SECRET_REF>_USERNAME / <SECRET_REF>_PASSWORD files, read on every connection before the environment. Optional. |
<SECRET_REF>_USERNAME / <SECRET_REF>_PASSWORD |
src/lib/secrets/credentials.ts |
Per-source credentials resolved at execution time. See Source secret references. |
APP_VERSION, GIT_COMMIT |
src/lib/version.ts |
Build identity reported by GET /api/health. Optional. See Health and readiness. |
METRICS_TOKEN, METRICS_ALLOWED_CIDRS |
src/lib/metrics-access.ts |
Who may scrape GET /api/metrics. Unset on both closes the endpoint. Read outside config.ts because that module reaches the browser bundle. See Prometheus metrics. |