fix: allow clearing saved config by setting empty env var
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -109,8 +109,17 @@ class Config:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def save_current(cls) -> bool:
|
def save_current(cls) -> bool:
|
||||||
existing = cls.load().get("env", {})
|
existing = cls.load().get("env", {})
|
||||||
current = cls.capture_current().get("env", {})
|
merged = dict(existing)
|
||||||
merged = {**existing, **current}
|
|
||||||
|
for var_name in cls.tracked_vars():
|
||||||
|
value = os.getenv(var_name)
|
||||||
|
if value is None:
|
||||||
|
pass
|
||||||
|
elif value == "":
|
||||||
|
merged.pop(var_name, None)
|
||||||
|
else:
|
||||||
|
merged[var_name] = value
|
||||||
|
|
||||||
return cls.save({"env": merged})
|
return cls.save({"env": merged})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user