Files
openclaw-skill/openclaw-knowhow-skill/docs/infrastructure/environment.md
Selig 4c966a3ad2 Initial commit: OpenClaw Skill Collection
6 custom skills (assign-task, dispatch-webhook, daily-briefing,
task-capture, qmd-brain, tts-voice) with technical documentation.
Compatible with Claude Code, OpenClaw, Codex CLI, and OpenCode.
2026-03-13 10:58:30 +08:00

39 lines
1.3 KiB
Markdown

# Environment Variables Documentation
OpenClaw manages environment variables through a hierarchical system that respects existing values without overriding them.
## Loading Priority
The system follows a specific precedence order from highest to lowest priority:
1. **Process environment** - Variables already present in the parent shell/daemon
2. **Local `.env` file** - Located in the current working directory
3. **Global `.env` file** - Found at `~/.openclaw/.env`
4. **Configuration file settings** - The `env` block in `~/.openclaw/openclaw.json`
5. **Shell environment import** - Optional login-shell variables when enabled
## Configuration Methods
You can define variables directly within the config file using two equivalent approaches:
```json5
{
env: {
OPENROUTER_API_KEY: "sk-or-...",
vars: {
GROQ_API_KEY: "gsk-...",
},
},
}
```
Shell environment import capability allows the system to run your login shell and import only missing expected keys.
## Variable Substitution
Config files support variable references using `${VAR_NAME}` syntax within string values, enabling dynamic configuration based on environment settings.
## Related Resources
The documentation links to gateway configuration guides, FAQ materials about env var loading, and models overview pages for additional context.