Environment variables
OpenClaw reads env vars from the parent process plus:.envfrom the current working directory (if present)~/.openclaw/.env(global fallback)
Shell env import (optional)
Shell env import (optional)
If enabled and expected keys aren’t set, OpenClaw runs your login shell and imports only the missing keys:Env var equivalent:
OPENCLAW_LOAD_SHELL_ENV=1. Default timeoutMs: 15000.Env var substitution in config values
Env var substitution in config values
Reference env vars in any config string value with Rules:
${VAR_NAME}:- Only uppercase names matched:
[A-Z_][A-Z0-9_]* - Missing/empty vars stay visibly unresolved, emit a warning, and are unavailable to consumers that require the value
- Escape with
$${VAR}to produce a literal${VAR}value - Works inside
$includefiles - Inline substitution:
"${BASE}/v1"→"https://api.example.com/v1"
Secret refs (env, file, exec, store)
Secret refs (env, file, exec, store)
For fields that support SecretRef objects, you can use:The
env ref above uses the built-in default provider and needs no secrets.providers.default entry unless secrets.defaults.env selects another alias. The same rule applies to store refs and secrets.defaults.store. See Secrets Management for provider precedence and the required file/exec provider configuration.
Supported credential paths are listed in SecretRef Credential Surface.