From 9e86d46267c4ad4c93e0cabbe137908c8f822c97 Mon Sep 17 00:00:00 2001 From: zhayujie Date: Thu, 16 Apr 2026 21:32:07 +0800 Subject: [PATCH] fix: sync env vars when updating config in docker env --- plugins/cow_cli/cow_cli.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/cow_cli/cow_cli.py b/plugins/cow_cli/cow_cli.py index 9dda19cc..92e9db8f 100644 --- a/plugins/cow_cli/cow_cli.py +++ b/plugins/cow_cli/cow_cli.py @@ -399,6 +399,13 @@ class CowCliPlugin(Plugin): except Exception as e: return f"写入 config.json 失败: {e}" + # Sync updated values to environment variables so that load_config() + # won't overwrite the new value with a stale env var (common in Docker). + from config import available_setting + for k, v in updates.items(): + if k in available_setting and k.upper() in os.environ: + os.environ[k.upper()] = str(v) + try: load_config() except Exception as e: