Skip to content

fix(config): route API keys and tokens to .env instead of config.yaml#469

Merged
teknium1 merged 1 commit intoNousResearch:mainfrom
ygd58:fix-api-key-config-routing
Mar 6, 2026
Merged

fix(config): route API keys and tokens to .env instead of config.yaml#469
teknium1 merged 1 commit intoNousResearch:mainfrom
ygd58:fix-api-key-config-routing

Conversation

@ygd58
Copy link
Copy Markdown
Contributor

@ygd58 ygd58 commented Mar 6, 2026

Fixes #465

Problem

hermes config set OPENAI_API_KEY sk-xxx was saving the key to config.yaml instead of .env, despite docs stating secrets go to .env.

Root Cause

The api_keys allowlist in set_config_value() was missing several common keys (OPENAI_API_KEY, NOUS_API_KEY, WANDB_API_KEY, TINKER_API_KEY) and had no catch-all pattern for future keys.

Fix

  • Added missing keys to the allowlist
  • Added catch-all patterns: any key ending in _API_KEY or _TOKEN now automatically routes to .env
  • This future-proofs the logic for any new API keys added to the project
@ygd58 ygd58 force-pushed the fix-api-key-config-routing branch from 2f84f10 to 6055adb Compare March 6, 2026 07:55
@teknium1 teknium1 merged commit 145f719 into NousResearch:main Mar 6, 2026
1 check passed
teknium1 added a commit that referenced this pull request Mar 6, 2026
Verifies explicit allowlist keys, catch-all _API_KEY/_TOKEN patterns,
case insensitivity, TERMINAL_SSH prefix, and config.yaml routing for
non-secret keys. Covers the fix from PR #469.
@teknium1
Copy link
Copy Markdown
Contributor

teknium1 commented Mar 6, 2026

Merged in commit b89eb29 🎉 Thanks @ygd58!

The catch-all pattern is a great idea — it also covers DAYTONA_API_KEY and ELEVENLABS_API_KEY that were missing from the explicit list.

Added 26 tests for the routing logic in commit c309678 (explicit allowlist, catch-all patterns, case insensitivity, config.yaml fallback).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants