Skip to content

fix: reload config from .env after saving settings via web UI#141

Open
kcuber118 wants to merge 1 commit intohydropix:mainfrom
kcuber118:fix/env-settings-not-reloading-on-save
Open

fix: reload config from .env after saving settings via web UI#141
kcuber118 wants to merge 1 commit intohydropix:mainfrom
kcuber118:fix/env-settings-not-reloading-on-save

Conversation

@kcuber118
Copy link
Copy Markdown

@kcuber118 kcuber118 commented Apr 26, 2026

Summary

  • Settings saved via web UI (POST /api/settings) correctly wrote to .env, but module-level config variables (DEEPSEEK_API_KEY, etc.) were never refreshed
  • On page refresh, /api/config returned stale empty values, causing "LLM: Error (No API Key)" — user had to re-enter API key every time
  • Added reload_config() to src/config.py that re-reads .env with override=True and updates all module variables
  • Called reload_config() after _update_env_file() in the save endpoint
  • Switched config_routes.py to read from live _config module instead of copied from X import Y values

Test plan

  • Select a provider (e.g. DeepSeek), enter API key and model, click "Save Settings to .env"
  • Refresh the page — API key should still show as configured (masked indicator visible)
  • Switch to the provider — models should load without "No API key" error
  • Verify the fix works for all providers: Gemini, OpenAI, OpenRouter, Mistral, DeepSeek, Poe, NIM

🤖 Generated with Claude Code

Settings saved through the web UI wrote to .env correctly, but module-level
variables (DEEPSEEK_API_KEY, etc.) were never refreshed. On page refresh,
/api/config returned stale empty values, causing "LLM: Error (No API Key)".

- Add reload_config() to src/config.py: re-reads .env with override=True
  and updates all module-level variables
- Call reload_config() after _update_env_file() in POST /api/settings
- Switch config_routes.py to read from live module instead of copied imports

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant