dbward uses TOML configuration files for its three binaries:
Binary Config file Purpose dbward-serverdbward-server.toml (via --config)Approval engine, policies, audit dbward-agentdbward-agent.toml (via --config)Database execution, polling dbward (CLI)~/.config/dbward/config.toml + ./dbward.tomlServer connection, project defaults
All files support variable expansion for secrets and environment-specific values.
environments = [ " production " ]
Field Type Required Default Description state_dirString ✓ — Directory for SQLite state and keys. Created on first start. trusted_proxiesString[] []CIDR ranges trusted for X-Forwarded-For. See trusted_proxies .
Registers a database that the server will accept requests for.
environments = [ " staging " , " production " ]
Field Type Required Default Description nameString ✓ — Logical database identifier. Referenced in workflows and policies. environmentsString[] ✓ — Environments this database operates in.
default_role = " readonly "
Field Type Required Default Description modeString "token" if [auth.oidc] absent; "both" if [auth.oidc] presentAuthentication mode: "token", "oidc", "both". Requires Team license for "oidc"/"both". default_roleString — Role assigned when no binding matches. Unset = reject unmatched users.
Requires auth.mode = "oidc" or "both" (explicit or implicit). Requires Team license.
issuer_url = " https://auth.example.com/realms/dbward "
Field Type Required Default Description issuer_urlString ✓ — OIDC issuer URL. Must be http:// or https://. Alias: issuer. audienceString ""Expected aud claim for JWT validation. At least one of audience or client_id must be non-empty. jwks_uriString — Override JWKS endpoint. Must be http:// or https:// if set. client_idString — Client ID used as aud claim if set. Takes precedence over audience. default_roleString — Role for OIDC users when no mapping matches. Falls back to [auth].default_role.
Maps OIDC claims to dbward roles.
[[auth.oidc.role_mappings]]
Field Type Required Default Description claimString ✓ — OIDC token claim name to inspect. valueString ✓ — Claim value that triggers the mapping. Exact match. roleString ✓ — dbward role to assign when matched.
Binds API token subjects or groups to roles.
subjects = [ " alice " , " bob " ]
Field Type Required Default Description roleString ✓ — Role to assign. Must be a built-in or custom role. subjectsString[] []Token subject identifiers to bind. groupsString[] []Group names. All members receive this role.
Define custom roles and groups in TOML.
permissions = [ " request.create " , " request.approve " , " audit.view " ]
members = [ " alice " , " bob " , " carol " ]
[[auth.roles]]
Field Type Required Default Description nameString ✓ — Role identifier. Cannot redefine built-ins: admin, developer, readonly, agent-default. permissionsString[] ✓ — Granted permissions (e.g. "request.create", "request.approve", "*"). Full list → databasesString[] []Restrict to specific databases. Empty = all. environmentsString[] []Restrict to specific environments. Empty = all.
[[auth.groups]]
Field Type Required Default Description nameString ✓ — Group identifier. Referenced in role_bindings and workflow approvers. membersString[] ✓ — Token subject identifiers belonging to this group.
Pre-provision users and manage their lifecycle via config.
Field Type Required Default Description idString ✓ — User identifier (must match the subject_id used in authentication). statusString "active"User status: "active" or "suspended".
Behavior on sync (server start / reload):
Setting status = "suspended" revokes all API tokens and cancels all pending requests for that user — equivalent to the API suspend endpoint.
Changing status back to "active" re-enables the user, but revoked tokens remain revoked. Issue new tokens after reactivation.
Removing a user from config revokes tokens, cancels requests, and deletes the user record.
If a user ID already exists with a different source (e.g., created via OIDC login), the config entry is skipped with a warning to prevent conflicts.
Defines approval requirements per database × environment × operation.
environment = " production "
operations = [ " execute_dml " , " migrate_up " ]
[[workflows.steps.approvers]]
Field Type Required Default Description databaseString "*"Scope filter. "*" matches all databases. environmentString "*"Scope filter. "*" matches all environments. operationsString[] []Operations filter. Empty = all. Values: execute_select, execute_dml, migrate_up, migrate_down, migrate_status, migrate_repair. stepsStep[] []Approval steps. Empty = auto-approve. require_reasonbool falseReject requests without --reason. allow_self_approvebool falseAllow requester to approve own request. allow_same_approver_across_stepsbool trueAllow same person to approve multiple steps. explainbool trueAuto-run EXPLAIN on request creation. pending_ttl_secsu64 — Request expires if not approved within this window. Falls back to retention.approval_ttl_secs. statement_timeout_secsu64 — Override agent’s statement timeout. Capped by execution_policies.max_statement_timeout_secs.
Field Type Required Default Description modeString "all""all": every approver entry satisfied. "any": any single entry suffices.approversApprover[] ✓ — Approver requirements.
Approver entry (use exactly one of role, group, or user):
Field Type Required Default Description roleString — Role whose members can approve. groupString — Group whose members can approve. userString — Specific user subject. minu32 1Minimum approvals needed from this entry.
Risk-based automatic approval.
Field Type Required Default Description databaseString "*"Scope filter. environmentString "*"Scope filter. riskString "none"Max risk level: "none", "low", "medium", "high". "none" = disabled. allow_read_onlybool trueSELECT counts as Low risk. allow_safe_ddlbool trueCREATE TABLE/INDEX/VIEW counts as Low risk. max_estimated_rowsu64 1000Threshold for large-table risk increase.
Static SQL analysis rules. Typos in field names cause startup error (deny_unknown_fields).
By default, high-risk destructive operations are blocked (rejected immediately). To relax rules for development environments, override them in your TOML config:
no_where_delete = " warn " # or "off" to disable entirely
Field Type Required Default Description no_where_deleteString "block"DELETE without WHERE. Values: "block", "warn", "off". no_where_updateString "block"UPDATE without WHERE. drop_tableString "block"DROP TABLE. drop_columnString "warn"ALTER TABLE DROP COLUMN. not_null_without_defaultString "warn"NOT NULL column without DEFAULT. create_index_not_concurrentlyString "warn"CREATE INDEX without CONCURRENTLY (PostgreSQL). alter_column_typeString "warn"ALTER COLUMN TYPE. truncateString "block"TRUNCATE. mixed_ddl_dmlString "warn"DDL and DML in same request. large_in_listString "warn"IN clause with excessive values.
url = " https://hooks.slack.com/services/T.../B.../xxx "
secret = " ${WEBHOOK_SECRET} "
Field Type Required Default Description urlString ✓ — Webhook destination URL. secretString — HMAC-SHA256 key. Sent in X-Dbward-Signature. eventsString[] []Filter events. Empty = all. formatString "generic"Payload format: "generic" (JSON) or "slack" (Block Kit).
Rate limiting and timeout per scope.
environment = " production "
statement_timeout_secs = 60
Field Type Required Default Description databaseString "*"Scope filter. environmentString "*"Scope filter. max_executionsu32 — Max executions per window. Unset = no limit. execution_window_secsu64 — Time window for max_executions. retry_on_failurebool — Allow re-dispatch on failure. Unset = no retry. statement_timeout_secsu32 — SQL timeout. Unset = use agent default (30s). max_statement_timeout_secsu32 — Cap for workflow-level timeout override. migration_statement_timeout_secsu32 — Statement timeout for migrations. Unset = unlimited (no timeout). max_rowsu32 — Max result rows. Unset = no limit.
Field Type Required Default Description request_ttl_daysu64 90Auto-delete completed requests after N days. audit_ttl_daysu64 365Auto-delete audit events after N days. result_ttl_daysu64 30Auto-delete stored results after N days. approval_ttl_secsu64 86400Approved requests expire if not resumed within this window.
Field Type Required Default Description redactionString "literals"SQL redaction: "literals" (mask values), "full" (hide SQL), "none".
Field Type Required Default Description backendString "local"Storage backend: "local" or "s3". root_dirString "{state_dir}/results"Local backend directory. max_persist_bytesusize 10485760Results above 10 MB are not persisted. bucketString — S3 bucket name. Required when backend = "s3". regionString — AWS region for S3. endpointString — Custom S3 endpoint (MinIO, localstack). access_key_idString — S3 access key. Prefer IAM roles. secret_access_keyString — S3 secret key. path_stylebool falsePath-style S3 URLs (set true for MinIO). prefixString "results"Key prefix for S3 objects.
Note: [result_storage] is not hot-reloaded on SIGHUP. Changes require a process restart (task redeployment in ECS/Kubernetes).
In-memory relay for streaming results.
Field Type Required Default Description max_slotsusize 10000Max concurrent result slots. slot_ttl_secsu64 600Slot removed after 10 min if unclaimed.
Field Type Required Default Description levelString "info"Log level: debug, info, warn, error. formatString "text"Output format: "text" or "json". Overridden by DBWARD_LOG_FORMAT.
Slack integration for notifications and interactive approve/reject.
bot_token = " ${SLACK_BOT_TOKEN} "
signing_secret = " ${SLACK_SIGNING_SECRET} "
Field Type Required Default Description bot_tokenString ✓ — Slack Bot OAuth token (xoxb-...). signing_secretString ✓ — Slack signing secret for request verification. channelString "#db-approvals"Default channel (ID or name). channelsMap {}Per-environment override. Key = env, value = channel.
trusted_proxies = [ " 10.0.0.0/8 " , " 172.16.0.0/12 " ]
When empty (default), the direct connection IP is used. Required behind a load balancer for accurate audit log IPs.
url = " http://localhost:3000 "
agent_token = " ${DBWARD_AGENT_TOKEN} "
[databases.app.production]
Field Type Required Default Description agent_idString hostname Unique agent identifier. poll_interval_msu64 1000Milliseconds between poll requests. max_concurrent_tasksu32 2Max parallel executions. drain_timeout_secsu64 60Graceful shutdown wait. statement_timeout_secsu64 30Default SQL timeout. lease_duration_secsu64 300Job lease before server reclaims. operationsString[] all Operation types to handle. Unset = all. startup_retry_initial_msu64 1000Initial retry backoff. startup_retry_max_msu64 15000Max retry backoff. startup_max_wait_secsu64 60Max startup wait. 0 = wait forever.
Field Type Required Default Description urlString ✓ — Server URL to poll. agent_tokenString ✓ — Auth token. Use ${DBWARD_AGENT_TOKEN} expansion. allow_insecurebool falseAllow HTTP connections to non-local servers. The agent refuses to start with external HTTP unless this is true. See Security Hardening .
[databases.app.production]
url = " postgres://user:pass@db:5432/app "
Field Type Required Default Description urlString ✓ — Database connection URL. Scheme = driver (postgres:// or mysql://).
Field Type Required Default Description enabledbool trueEnable schema collection. sync_on_startupbool trueCollect on agent startup. interval_secsu64 0Periodic interval. 0 = startup + after migrations only.
Environment variables (DBWARD_SERVER_URL, DBWARD_TOKEN, etc.)
--config flag (standalone mode — no merging)
Project config (./dbward.toml or DBWARD_CONFIG)
Global config (~/.config/dbward/config.toml)
Field Type Required Default Description urlString ✓ — Server URL. tokenString — API token. Mutually exclusive with [server.oidc]. allow_insecurebool falseAllow HTTP connections to non-local servers. Suppresses the insecure-transport warning. Does not override OIDC+HTTP rejection.
Field Type Required Default Description issuerString ✓ — OIDC issuer URL. client_idString ✓ — OIDC client ID for PKCE. discovery_urlString — Override discovery endpoint. backchannel_urlString — Override token endpoint. browser_urlString — Override authorize URL.
Field Type Required Default Description default_databaseString — Database when --database omitted. default_environmentString — Environment when -e omitted. migrations_dirPath "./migrations"Migration SQL directory.
Field Type Required Default Description dirPath "~/.dbward/results"Local directory for saving query results. formatString "table"Default result format: table, json, csv, vertical.
Per-database override:
migrations_dir = " migrations/analytics "
Variable Description DBWARD_CONFIGProject config path. Enables standalone mode. DBWARD_SERVER_URLOverride server URL. DBWARD_TOKENOverride API token. DBWARD_DATABASEDefault database. DBWARD_ENVDefault environment. DBWARD_AGENT_TOKENAgent token (referenced via ${DBWARD_AGENT_TOKEN}). DBWARD_ALLOW_INSECUREtrue or 1 to allow HTTP to non-local servers. Overrides config file setting.DBWARD_LOG_FORMATForce "json" log output. Overrides [logging].format.
All TOML config files support shell-style variable expansion:
Syntax Behavior ${VAR}Required — startup error if unset. ${VAR:-default}Use default if unset. ${VAR:-}Empty string if unset.
agent_token = " ${DBWARD_AGENT_TOKEN} "
[databases.app.production]
url = " ${DATABASE_URL:-postgres://localhost:5432/app} "