You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add environment variable support for token exchange client secret (#2148)
Add support for reading the OAuth client secret from the
TOOLHIVE_TOKEN_EXCHANGE_CLIENT_SECRET environment variable when not
provided in the middleware configuration. This enables secure secret
injection via Kubernetes Secrets without embedding plaintext secrets
in ConfigMaps.
The middleware will:
1. First check if client_secret is provided in the config
2. If empty, read from TOOLHIVE_TOKEN_EXCHANGE_CLIENT_SECRET env var
3. Fall back to empty string if neither is provided
The implementation uses dependency injection for testability, with an
internal envGetter function that can be overridden in tests. This
allows comprehensive unit testing of all environment variable
scenarios without relying on actual environment manipulation.
This follows ToolHive's naming convention of prefixing all environment
variables with TOOLHIVE_ and is consistent with other secret handling
patterns in the codebase such as TOOLHIVE_REMOTE_OAUTH_CLIENT_SECRET.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <[email protected]>
0 commit comments