dynamic config reloading

This commit is contained in:
2026-01-28 16:13:32 -05:00
parent 1fbea7e701
commit a1ff38424b
6 changed files with 131 additions and 80 deletions

View File

@@ -10,21 +10,11 @@ router = APIRouter(prefix="/api", tags=["config"])
def reload_config_from_file():
#Reload config values from JSON into module globals
path = Path("data/config.json")
if not path.exists():
return
try:
with open(path, "r", encoding="utf-8") as f:
data = json.load(f)
# Update config module globals
for key, value in data.get("config", {}).items():
if hasattr(config_module, key):
setattr(config_module, key, value)
except Exception as e:
print(f"Error reloading config from file: {e}")
"""Reload config values from JSON - triggers dynamic reload"""
# With the new dynamic config system, we just need to call reload
# which will cause all future property accesses to read from the updated file
config_module.reload_config()
print("[CONFIG] Configuration reloaded after settings update")
@router.get("/config")