Preserve client sent config appropriately (#8566)

master
Harshavardhana 5 years ago committed by kannappanr
parent c3771df641
commit 0a56e33ce1
  1. 10
      cmd/config/config.go
  2. 1
      cmd/config/notify/parse.go

@ -466,14 +466,10 @@ func (c Config) SetKVS(s string, defaultKVS map[string]KVS) error {
tgt = subSystemValue[1] tgt = subSystemValue[1]
} }
_, ok := c[subSys][tgt] // Save client sent kvs
if !ok { c[subSys][tgt] = kvs
c[subSys][tgt] = KVS{}
} else {
c[subSys][tgt] = kvs
}
_, ok = c[subSys][tgt].Lookup(State) _, ok := c[subSys][tgt].Lookup(State)
if !ok { if !ok {
// implicit state "on" if not specified. // implicit state "on" if not specified.
c[subSys][tgt] = append(c[subSys][tgt], KV{ c[subSys][tgt] = append(c[subSys][tgt], KV{

@ -564,6 +564,7 @@ func GetNotifyMQTT(mqttKVS map[string]config.KVS, rootCAs *x509.CertPool) (map[s
if k != config.Default { if k != config.Default {
brokerEnv = brokerEnv + config.Default + k brokerEnv = brokerEnv + config.Default + k
} }
brokerURL, err := xnet.ParseURL(env.Get(brokerEnv, kv.Get(target.MqttBroker))) brokerURL, err := xnet.ParseURL(env.Get(brokerEnv, kv.Get(target.MqttBroker)))
if err != nil { if err != nil {
return nil, err return nil, err

Loading…
Cancel
Save