feat(reflector): require MQTT_NAME when twin-mode + MQTT both enabled

Two twin reflectors sharing a broker need disjoint MQTT subtrees;
MQTT_NAME is the per-reflector path component. Failing fast at
startup is better than silent retained-topic corruption when the
operator forgets to set it.
This commit is contained in:
Audric committed 2026-04-29 16:46:23 +02:00
1 parent f4bc684d7b
commit 83bbfc4fab
2 files changed
+28 -1

No files matched your search

+5 -1
View File
@@ -417,8 +417,12 @@ def generate_twin_reflector_conf(name: str) -> str:
f"PASSWORD={T.MQTT['password']}",
f"TOPIC_PREFIX=svxreflector/{name}",
"STATUS_INTERVAL=1000",
"",
]
# Twin pair members must have MQTT_NAME to avoid retained-topic collision
# when both reflectors share the same broker (enforced by Reflector::initialize).
if r.get("twin_of"):
lines.append(f"MQTT_NAME={name}")
lines.append("")
if r.get("redis"):
lines += [