fix: sync env vars when updating config in docker env

This commit is contained in:
zhayujie
2026-04-16 21:32:07 +08:00
parent 848430f062
commit 9e86d46267

View File

@@ -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: