chore: Optimize Database.py to improve configuration handling

This commit is contained in:
Théophile Diot 2024-08-08 16:20:38 +01:00
parent 428169dcd4
commit 04a2c7ae08
No known key found for this signature in database
GPG key ID: FA995104A0BA376A

View file

@ -1798,7 +1798,7 @@ class Database:
config["SERVER_NAME"] = {
"value": servers,
"global": True,
"method": "default",
"method": "scheduler",
"template": None,
}
@ -1867,7 +1867,7 @@ class Database:
for template_setting in query:
key = template_setting.setting_id + (f"_{template_setting.suffix}" if template_setting.suffix > 0 else "")
if key in config and (config[key]["method"] != "default" or key == "SERVER_NAME" and config[key]["value"] != template_setting.default):
if key in config and config[key]["method"] != "default":
continue
config[key] = {
@ -1892,9 +1892,7 @@ class Database:
for setting in query:
key = f"{service_id}_{setting.setting_id}" + (f"_{setting.suffix}" if setting.suffix > 0 else "")
if key in config and (
config[key]["method"] != "default" or setting.setting_id == "SERVER_NAME" and config[key]["value"] != template_setting.default
):
if key in config and config[key]["method"] != "default":
continue
config[key] = {