chirpstack / chirpstack-gateway-bridge

ChirpStack Gateway Bridge abstracts Packet Forwarder protocols into Protobuf or JSON over MQTT.
https://www.chirpstack.io
MIT License
415 stars 269 forks source link

Allow multiple MQTT brokers #141

Closed sa-wilson closed 4 years ago

sa-wilson commented 4 years ago

Partially covers #93

Add a new config option servers for a list of MQTT brokers to connect to and fall back to existing server option if servers is empty/unset.

Left default of using server alone, as I didn't want to break existing configurations by adding a non-empty default to servers.

brocaar commented 4 years ago

Thanks @sa-wilson :+1: Besides fixing the conflict (presumable after the rename to ChirpStack), I have made a small change. I don' like having server and servers in the configuration file next to each other.

I have removed server from the configfile. However, when it is set, servers will be set to []string{server}. This means that when re-generating the file using chirpstack-gateway-bridge configfile -c old.toml > new.toml, the server key will be automatically migrated to servers :slightly_smiling_face:

sa-wilson commented 4 years ago

Awesome.

I wasn't the biggest fan of it either, but it seemed to be the easiest way to keep backwards compatibility at the time. Your way is better.