dynamic config reloading
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user