diff --git a/src/common/db/Database.py b/src/common/db/Database.py index 77d162574..959e9e4c5 100644 --- a/src/common/db/Database.py +++ b/src/common/db/Database.py @@ -1586,25 +1586,24 @@ def get_non_default_settings( if global_value.context == "multisite": multisite.add(setting_id) + is_multisite = config.get("MULTISITE", {"value": "no"})["value"] == "yes" if methods else config.get("MULTISITE", "no") == "yes" + services = session.query(Services).with_entities(Services.id, Services.is_draft) if not with_drafts: services = services.filter_by(is_draft=False) - servers = "" - for service in services: - if not global_only: + if not global_only and is_multisite: + servers = "" + for service in services: config[f"{service.id}_IS_DRAFT"] = "yes" if service.is_draft else "no" if methods: config[f"{service.id}_IS_DRAFT"] = {"value": config[f"{service.id}_IS_DRAFT"], "global": False, "method": "default"} for key in multisite: config[f"{service.id}_{key}"] = config[key] - servers += f"{service.id} " - servers = servers.strip() - - config["SERVER_NAME"] = servers if not methods else {"value": servers, "global": True, "method": "default"} + servers += f"{service.id} " + servers = servers.strip() - if not global_only and (config.get("MULTISITE", {"value": "no"})["value"] == "yes" if methods else config.get("MULTISITE", "no") == "yes"): # Define the join operation j = join(Services, Services_settings, Services.id == Services_settings.service_id) j = j.join(Settings, Settings.id == Services_settings.setting_id) @@ -1643,6 +1642,10 @@ def get_non_default_settings( config[f"{result.service_id}_{result.setting_id}" + (f"_{result.suffix}" if result.multiple and result.suffix else "")] = ( value if not methods else {"value": value, "global": False, "method": result.method} ) + else: + servers = " ".join(service.id for service in services) + + config["SERVER_NAME"] = servers if not methods else {"value": servers, "global": True, "method": "default"} return config