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
All checks were successful
Build and Push / build (push) Successful in 12m16s
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user