feat: add discord wakeup test endpoint
This commit is contained in:
26
app/services/harborforge_config.py
Normal file
26
app/services/harborforge_config.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import json
|
||||
import os
|
||||
from typing import Any
|
||||
|
||||
CONFIG_DIR = os.getenv("CONFIG_DIR", "/config")
|
||||
CONFIG_FILE = os.getenv("CONFIG_FILE", "harborforge.json")
|
||||
|
||||
|
||||
def load_runtime_config() -> dict[str, Any]:
|
||||
config_path = os.path.join(CONFIG_DIR, CONFIG_FILE)
|
||||
if not os.path.exists(config_path):
|
||||
return {}
|
||||
try:
|
||||
with open(config_path, "r") as f:
|
||||
return json.load(f)
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
|
||||
def get_discord_wakeup_config() -> dict[str, str | None]:
|
||||
cfg = load_runtime_config()
|
||||
discord_cfg = cfg.get("discord") or {}
|
||||
return {
|
||||
"guild_id": discord_cfg.get("guild_id"),
|
||||
"bot_token": discord_cfg.get("bot_token"),
|
||||
}
|
||||
Reference in New Issue
Block a user