Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sebslight
Copy link
Member

Summary

Support ${VAR_NAME} syntax in any config string value, substituted at config load time.

{
  models: {
    providers: {
      "vercel-gateway": {
        apiKey: "${VERCEL_GATEWAY_API_KEY}"
      }
    }
  }
}
  • Only uppercase env vars matched: [A-Z_][A-Z0-9_]*
  • Missing/empty env vars throw MissingEnvVarError with path context
  • Escape with $${VAR} to output literal ${VAR}
  • Works with $include (included files also get substitution)
  • Substitution happens after $include resolution, before schema validation

Closes #1009

Test plan

  • 28 unit tests covering basic substitution, nested objects/arrays, missing var errors, escape syntax, and passthrough behavior
  • Full test suite passes (652 files, 3438 tests)
  • Lint and build pass

Support ${VAR_NAME} syntax in any config string value, substituted at
config load time. Useful for referencing API keys and secrets from
environment variables without hardcoding them in the config file.

- Only uppercase env vars matched: [A-Z_][A-Z0-9_]*
- Missing/empty env vars throw MissingEnvVarError with path context
- Escape with $${VAR} to output literal ${VAR}
- Works with $include (included files also get substitution)

Closes openclaw#1009
@steipete steipete merged commit 7310803 into openclaw:main Jan 17, 2026
22 checks passed
@steipete
Copy link
Contributor

Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Land commit: 25399d3\n- Merge commit: 7310803\n\nThanks @sebslight!

TSavo pushed a commit to TSavo/clawdbot that referenced this pull request Jan 18, 2026
rsneh pushed a commit to rsneh/clawdbot that referenced this pull request Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support referencing environment variables in .clawdbot.json

2 participants