Add clientid to config

Allow the ability to configure the clientid in the configuration file
This commit is contained in:
Felix Niederwanger 2022-10-02 10:51:12 +02:00
parent fb1dae7a85
commit adebdb00ff
Signed by: phoenix
GPG key ID: 6E77A590E3F6D71C
3 changed files with 5 additions and 0 deletions

View file

@ -130,6 +130,9 @@ func (c *Config) ReadFile(filename string) error {
if val := mqtt.Key("remote").String(); val != "" {
c.mqttRemote = val
}
if val := mqtt.Key("clientid").String(); val != "" {
c.mqttClientId = val
}
www := cfg.Section("www")
if val := www.Key("remote").String(); val != "" {
c.wwwDir = val

View file

@ -117,6 +117,7 @@ func (mqtt *MQTTReceiver) mqttConnectionLost(client MQTT.Client, err error) {
if token.Wait() {
break
}
time.Sleep(2 * time.Second)
}
log.Printf("MQTT connection %s established", remote)
}

View file

@ -2,6 +2,7 @@
[mqtt]
remote = 127.0.0.1
clientid = ot-browser
[www]
dir = ./www