Secrets & Configuration¶
Configuration behavior is defined primarily by src/config.rs. This page sticks to what that code actually does today.
Load pipeline¶
Config loading follows this order:
- read YAML from disk
- expand environment variables with
shellexpand::env - deserialize YAML into
Config - validate transport-specific requirements
- resolve
secretref:values asynchronously - re-check for unresolved secret refs
.env load order¶
.env files are loaded exactly once per process.
Locations, in order:
~/.env- the standard Gatemini config directory, for example
~/.config/gatemini/.env - a
.envnext to the chosen config file
Later files override earlier ones.
Hot-reload does not re-run .env loading. If you change .env, restart the process.
Top-level defaults¶
Current defaults from src/config.rs:
| Setting | Default |
|---|---|
log_level | info |
allow_runtime_registration | true |
max_dynamic_backends | 10 |
daemon.idle_timeout | 5m |
daemon.client_drain_timeout | 30s |
sandbox.timeout | 30s |
sandbox.max_output_size | 200000 |
sandbox.max_concurrent_sandboxes | 8 |
sandbox.output.auto_chunk_json | true |
sandbox.output.smart_truncation | true |
sandbox.output.chunk_threshold | 10240 |
admin.listen | 127.0.0.1:19999 |
Transport defaults:
- backend transport defaults to
stdio - backend timeout defaults to
30s - retry defaults to 3 attempts with
500msinitial delay,2smax delay, multiplier2.0 instance_modedefaults tosharedpool.min_idledefaults to1pool.max_instancesdefaults to20pool.acquire_timeoutdefaults to30spool.replenish_delaydefaults to2sshutdown_grace_perioddefaults to5smax_memory_mbdefaults to none (no limit)health.memory_check_intervaldefaults to30shealth.memory_restart_cooldowndefaults to60s
Supported transports¶
The config enum is kebab-case and accepts:
stdiostreamable-httpcli-adapter
Example:
Secret resolution modes¶
Direct environment variables¶
secretref:bws:... with environment fallback¶
When Bitwarden Secrets Manager is disabled, the fallback provider still accepts secretref:bws:... and resolves the last path segment as an environment variable name.
With BWS disabled, that looks for GITHUB_PAT_TOKEN in the environment.
Bitwarden Secrets Manager¶
secrets:
strict: true
providers:
bws:
enabled: true
access_token: "${BWS_ACCESS_TOKEN}"
organization_id: "${BWS_ORG_ID}"
What fields secret resolution touches¶
Secret resolution walks through:
- backend command
- backend args
- backend env map
- backend URL
- backend headers
- prerequisite command
- prerequisite args
- prerequisite env map
Validation behavior¶
Validation checks include:
- required fields by transport
- valid transport values
- required CLI adapter definitions
- unresolved secret refs after resolution
The config loader does not implement a general shell language. It performs environment interpolation and then Rust-side validation.
Hot reload¶
The config watcher can apply a useful subset of changes without a daemon restart.
Hot-reloaded today:
- backend additions, removals, and config changes
- aliases
- backend-owned tags and fallback-chain changes through backend reconfiguration
Detected but not applied live:
- composite tool changes
Read once at startup:
- daemon lifecycle settings
.envcontents
Admin config note¶
admin.allowed_cidrs exists in config, but the current admin route implementation does not enforce CIDR checks. The binding address still matters because the admin server listens only on admin.listen.