mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-08-07 09:13:04 +02:00
Add WebSocket path config for community MQTT
Path hardcoded to "/". Brokers like analyzer.montrealmesh.ca need non-root path (e.g. /mqtt). Expose field in fanout config + UI.
This commit is contained in:
@@ -70,6 +70,7 @@ def _make_community_settings(**overrides) -> SimpleNamespace:
|
||||
"community_mqtt_iata": "",
|
||||
"community_mqtt_email": "",
|
||||
"community_mqtt_token_audience": "mqtt-us-v1.letsmesh.net",
|
||||
"community_mqtt_websocket_path": "/",
|
||||
}
|
||||
defaults.update(overrides)
|
||||
return SimpleNamespace(**defaults)
|
||||
@@ -738,6 +739,24 @@ class TestLwtAndStatusPublish:
|
||||
assert kwargs["tls_context"] is not None
|
||||
assert kwargs["username"] == f"v1_{pubkey_hex}"
|
||||
|
||||
def test_build_client_kwargs_custom_websocket_path(self):
|
||||
pub = CommunityMqttPublisher()
|
||||
private_key, public_key = _make_test_keys()
|
||||
settings = _make_community_settings(
|
||||
community_mqtt_iata="MTL",
|
||||
community_mqtt_websocket_path="/mqtt",
|
||||
)
|
||||
|
||||
with (
|
||||
patch("app.keystore.get_private_key", return_value=private_key),
|
||||
patch("app.keystore.get_public_key", return_value=public_key),
|
||||
patch("app.radio.radio_manager") as mock_radio,
|
||||
):
|
||||
mock_radio.meshcore = None
|
||||
kwargs = pub._build_client_kwargs(settings)
|
||||
|
||||
assert kwargs["websocket_path"] == "/mqtt"
|
||||
|
||||
def test_build_client_kwargs_supports_tcp_transport_and_custom_audience(self):
|
||||
pub = CommunityMqttPublisher()
|
||||
private_key, public_key = _make_test_keys()
|
||||
|
||||
Reference in New Issue
Block a user