From 757e4a2cec4b24faf79191d2ff3bc6a1dde47c50 Mon Sep 17 00:00:00 2001 From: Grische <2787581+grische@users.noreply.github.com> Date: Wed, 3 Jan 2024 18:43:23 +0100 Subject: [PATCH] make fallback domain configurable --- README.md | 1 + unifi_respondd.yaml.example | 3 ++- unifi_respondd/config.py | 2 ++ unifi_respondd/unifi_client.py | 4 +--- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 777d2b4..74943fe 100644 --- a/README.md +++ b/README.md @@ -48,4 +48,5 @@ logging_config: - console level: DEBUG version: 1 +fallback_domain: "unifi_respondd_fallback" # optional ``` diff --git a/unifi_respondd.yaml.example b/unifi_respondd.yaml.example index 9fbd069..48dd1dd 100644 --- a/unifi_respondd.yaml.example +++ b/unifi_respondd.yaml.example @@ -28,4 +28,5 @@ logging_config: handlers: - console level: DEBUG - version: 1 \ No newline at end of file + version: 1 +fallback_domain: "unifi_respondd_fallback" # optional diff --git a/unifi_respondd/config.py b/unifi_respondd/config.py index f93cc3f..5801568 100644 --- a/unifi_respondd/config.py +++ b/unifi_respondd/config.py @@ -35,6 +35,7 @@ class Config: ssid_regex: str offloader_mac: Dict[str, str] nodelist: str + fallback_domain: str multicast_address: str multicast_port: int @@ -64,6 +65,7 @@ def from_dict(cls, cfg: Dict[str, str]) -> "Config": ssid_regex=cfg["ssid_regex"], offloader_mac=cfg["offloader_mac"], nodelist=cfg["nodelist"], + fallback_domain=cfg.get("fallback_domain", "unifi_respondd_fallback"), version=cfg["version"], ssl_verify=cfg["ssl_verify"], multicast_enabled=cfg["multicast_enabled"], diff --git a/unifi_respondd/unifi_client.py b/unifi_respondd/unifi_client.py index 52a36f5..cfd46d3 100644 --- a/unifi_respondd/unifi_client.py +++ b/unifi_respondd/unifi_client.py @@ -268,9 +268,7 @@ def get_infos(): gateway6=offloader.get("gateway6", None), gateway_nexthop=offloader_id, neighbour_macs=neighbour_macs, - domain_code=offloader.get( - "domain", "ffmuc_unifi_respondd_fallback" - ), + domain_code=offloader.get("domain", cfg.fallback_domain), ) ) return aps