From 42df19195df7e0be69d2f907ed024c6dca948c80 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sat, 14 Mar 2026 00:58:08 +0100 Subject: [PATCH] config: renamed `common.hosts_dict` to `common.hosts` and improved its description --- libervia/backend/core/xmpp.py | 2 +- libervia/backend/tools/config.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libervia/backend/core/xmpp.py b/libervia/backend/core/xmpp.py index 96dafb35..82629cbe 100644 --- a/libervia/backend/core/xmpp.py +++ b/libervia/backend/core/xmpp.py @@ -1056,7 +1056,7 @@ class SatXMPPClient(SatXMPPEntity, core_types.SatXMPPClient, wokkel_client.XMPPC # for now we consider Android devices to be always phones self.identities = [disco.DiscoIdentity("client", "phone", C.APP_NAME)] - hosts_map = G.config.common.hosts_dict + hosts_map = G.config.common.hosts if host is None and user_jid.host in hosts_map: host_data = hosts_map[user_jid.host] if isinstance(host_data, str): diff --git a/libervia/backend/tools/config.py b/libervia/backend/tools/config.py index 1b7b60e6..ba4d5548 100644 --- a/libervia/backend/tools/config.py +++ b/libervia/backend/tools/config.py @@ -300,8 +300,15 @@ class CommonSettings(ConfigOptions): pubsub_cache_strategy: Literal["no_cache"] | None = Field( default=None, description="PubSub cache strategy" ) - hosts_dict: dict[str, dict] = Field( - default_factory=dict, description="Dictionary of host configurations" + hosts: dict[str, dict | str] = Field( + default_factory=dict, + description=( + "Mapping of XMPP domains to their connection host (hostname or IP) and port. " + " Allows overriding the connection target for specific domains. Each entry" + " can be either a string (host only) or a dictionary with 'host' and 'port'" + " keys. Example: {'example.com': 'backend.example.com'} or {'example.com':" + " {'host': '192.168.1.100', 'port': 5222}}" + ), ) ack_timeout: int = Field( default=35,