Added ability to specify custom conf directory

This commit is contained in:
Conner Harkness 2025-03-11 08:42:23 -06:00
parent 3e2f8e61b2
commit 264c099fad
4 changed files with 17 additions and 11 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ __pycache__/
/*.log.txt /*.log.txt
/*.log.txt.* /*.log.txt.*
/database.db /database.db
/conf_2

0
comfyui-discord.sh Normal file → Executable file
View File

View File

@ -54,6 +54,10 @@ async def on_message_or_reaction(client, obj):
# #
# #
settings = get_settings()
CONFIG_DIR = settings["config_dir"]
chl_topic_parts = [] chl_topic_parts = []
chl_topic_part_1 = "" chl_topic_part_1 = ""
if chl.topic is not None: if chl.topic is not None:
@ -62,11 +66,11 @@ async def on_message_or_reaction(client, obj):
# Try different paths to find workflow .json file: # Try different paths to find workflow .json file:
workflow_paths = [ workflow_paths = [
f"conf/{chl.category.name}/{chl_topic_part_1}", f"{CONFIG_DIR}{chl.category.name}/{chl_topic_part_1}",
f"conf/{chl.category.name}/{chl.name}", f"{CONFIG_DIR}{chl.category.name}/{chl.name}",
f"conf/{chl_topic_part_1}", f"{CONFIG_DIR}{chl_topic_part_1}",
f"conf/{chl.name}", f"{CONFIG_DIR}{chl.name}",
f"conf/{chl.category.name}", f"{CONFIG_DIR}{chl.category.name}",
] ]
using_workflow_path = None using_workflow_path = None
@ -86,19 +90,19 @@ async def on_message_or_reaction(client, obj):
# #
setting_paths = [ setting_paths = [
f"conf/{chl.category.name}", f"{CONFIG_DIR}{chl.category.name}",
f"conf/{chl.name}", f"{CONFIG_DIR}{chl.name}",
] ]
for i in chl_topic_parts: for i in chl_topic_parts:
setting_paths = setting_paths + ["conf/" + i.strip()] setting_paths = setting_paths + [{CONFIG_DIR} + i.strip()]
setting_paths = setting_paths + [f"conf/{chl.category.name}/{chl.name}"] setting_paths = setting_paths + [f"{CONFIG_DIR}{chl.category.name}/{chl.name}"]
for i in chl_topic_parts: for i in chl_topic_parts:
setting_paths = setting_paths + [f"conf/{chl.category.name}/" + i.strip()] setting_paths = setting_paths + [f"{CONFIG_DIR}{chl.category.name}/" + i.strip()]
settings = get_settings()
for path in setting_paths: for path in setting_paths:
try_path = f"{path}_settings.json" try_path = f"{path}_settings.json"

View File

@ -8,6 +8,7 @@ def get_settings(initialize=False):
"handler_name": "default", "handler_name": "default",
"token": "PASTE_TOKEN_HERE", "token": "PASTE_TOKEN_HERE",
"api_url": "http://127.0.0.1:8188", "api_url": "http://127.0.0.1:8188",
"config_dir": "conf/",
"allow_repeat": True, "allow_repeat": True,
"show_repeat": True, "show_repeat": True,
"repeat_emoji": "♻️", "repeat_emoji": "♻️",