Fix Settings-saved API keys never actually being used
All checks were successful
Deploy / deploy (push) Successful in 22s
All checks were successful
Deploy / deploy (push) Successful in 22s
Every *_API_KEY was read from the env var once at startup and never
checked against settings.json again, so saving a new key on the
Settings page updated the file but had zero effect on real requests —
reported live as "SABnzbd rejected the API key" right after rotating
and saving a new one there. A saved key now overrides the .env value
at startup, matching what the Settings page's own toast already says
("restart the container to apply").
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
018bc58bbf
commit
20f348eb9e
1 changed files with 11 additions and 0 deletions
11
app.py
11
app.py
|
|
@ -164,6 +164,17 @@ OMBI_PORT = os.environ.get("OMBI_PORT", "3579")
|
|||
OMBI_URL = f"http://{OMBI_HOST}:{OMBI_PORT}"
|
||||
OMBI_API_KEY = os.environ.get("OMBI_API_KEY", "")
|
||||
|
||||
# A key saved via the Settings page lives in settings.json and must win over
|
||||
# the .env value here — otherwise "Save" on that page silently does nothing
|
||||
# for anything that actually calls out to the service.
|
||||
_saved_settings = load_settings()
|
||||
SONARR_API_KEY = _saved_settings.get("sonarr_api_key") or SONARR_API_KEY
|
||||
RADARR_API_KEY = _saved_settings.get("radarr_api_key") or RADARR_API_KEY
|
||||
SABNZBD_API_KEY = _saved_settings.get("sabnzbd_api_key") or SABNZBD_API_KEY
|
||||
TAUTULLI_API_KEY = _saved_settings.get("tautulli_api_key") or TAUTULLI_API_KEY
|
||||
PROWLARR_API_KEY = _saved_settings.get("prowlarr_api_key") or PROWLARR_API_KEY
|
||||
OMBI_API_KEY = _saved_settings.get("ombi_api_key") or OMBI_API_KEY
|
||||
|
||||
RT_HEADERS = {
|
||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
||||
"Accept-Language": "en-US,en;q=0.9",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue