Skip to content

Commit 0a4aa3e

Browse files
authored
fix: use constants in ConfigManager (#299)
1 parent 6cc5c98 commit 0a4aa3e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

comfy_cli/config_manager.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def load(self):
7575
if not os.path.exists(tmp_path):
7676
os.makedirs(tmp_path)
7777

78-
if "background" in self.config["DEFAULT"]:
79-
bg_info = self.config["DEFAULT"]["background"].strip("()").split(",")
78+
if constants.CONFIG_KEY_BACKGROUND in self.config["DEFAULT"]:
79+
bg_info = self.config["DEFAULT"][constants.CONFIG_KEY_BACKGROUND].strip("()").split(",")
8080
bg_info = [item.strip().strip("'") for item in bg_info]
8181
self.background = bg_info[0], int(bg_info[1]), int(bg_info[2])
8282

@@ -94,7 +94,7 @@ def get_env_data(self):
9494
data.append(("Config Path", self.get_config_file_path()))
9595

9696
launch_extras = ""
97-
if self.config.has_option("DEFAULT", "default_workspace"):
97+
if self.config.has_option("DEFAULT", constants.CONFIG_KEY_DEFAULT_WORKSPACE):
9898
data.append(
9999
(
100100
"Default ComfyUI workspace",
@@ -120,11 +120,15 @@ def get_env_data(self):
120120
else:
121121
data.append(("Recent ComfyUI workspace", "No recent run"))
122122

123-
if self.config.has_option("DEFAULT", "enable_tracking"):
123+
if self.config.has_option("DEFAULT", constants.CONFIG_KEY_ENABLE_TRACKING):
124124
data.append(
125125
(
126126
"Tracking Analytics",
127-
("Enabled" if self.config["DEFAULT"]["enable_tracking"] == "True" else "Disabled"),
127+
(
128+
"Enabled"
129+
if self.config["DEFAULT"][constants.CONFIG_KEY_ENABLE_TRACKING] == "True"
130+
else "Disabled"
131+
),
128132
)
129133
)
130134

@@ -143,7 +147,7 @@ def get_env_data(self):
143147
return data
144148

145149
def remove_background(self):
146-
del self.config["DEFAULT"]["background"]
150+
del self.config["DEFAULT"][constants.CONFIG_KEY_BACKGROUND]
147151
self.write_config()
148152
self.background = None
149153

0 commit comments

Comments
 (0)