Open mullerch opened 2 years ago
The use-case for this is the last will and testament feature, as in this case we must know the gateway id before connecting to the MQTT broker (as the LWT is a connection parameter).
I would like to avoid adding more config options for the sake of complexity, but I agree that this could be documented better.
Actually, if we set client_id in the MQTT auth, the CSGB will try to use it as the gateway ID: https://github.com/chirpstack/chirpstack-gateway-bridge/blob/a20e0ac889adf490a6d687a04da8b384e77d65ec/internal/integration/mqtt/backend.go#L150.
This only covers the very specific use case where the gateway ID has to be taken from the client ID. If we just want the client ID to be set, we either have the gateway ID overridden or a warning printed. This behavior should be documented.
My suggestion is to add an option. Either a
use_client_id_as_gateway_id=boolean
in the mqtt section or agateway_id_source=string (backend/mqtt_client_id)
in the integration section. This way a fatal error can be generated if the target configuration is inconsistent.