fix: DB values override env vars in campaign settings, Settings page resets on campaign switch
All checks were successful
Build and Push / build (push) Successful in 12m16s

This commit is contained in:
KansaiGaijin
2026-07-21 18:35:28 +12:00
parent 9e70b78d7c
commit 4e2a99829f
2 changed files with 9 additions and 6 deletions

View File

@@ -85,13 +85,13 @@ CAMPAIGN_ENV_OVERRIDES = {
def merge_campaign_settings_with_env(raw: dict) -> dict:
"""Priority: env var > DB value > CAMPAIGN_SETTINGS default."""
"""Priority: DB value > env var > CAMPAIGN_SETTINGS default."""
merged = {**CAMPAIGN_SETTINGS}
for key, val in raw.items():
if val and val.strip():
merged[key] = val.strip()
for key, env_name in CAMPAIGN_ENV_OVERRIDES.items():
val = os.environ.get(env_name)
if val is not None:
merged[key] = val
for key, val in raw.items():
if val and val.strip():
merged[key] = val.strip()
return merged