From 0a56e33ce1b50b79c8c67de6a8d57b33836cffe2 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 22 Nov 2019 13:46:05 -0800 Subject: [PATCH] Preserve client sent config appropriately (#8566) --- cmd/config/config.go | 10 +++------- cmd/config/notify/parse.go | 1 + 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cmd/config/config.go b/cmd/config/config.go index 7483ce911..fc8b7d32a 100644 --- a/cmd/config/config.go +++ b/cmd/config/config.go @@ -466,14 +466,10 @@ func (c Config) SetKVS(s string, defaultKVS map[string]KVS) error { tgt = subSystemValue[1] } - _, ok := c[subSys][tgt] - if !ok { - c[subSys][tgt] = KVS{} - } else { - c[subSys][tgt] = kvs - } + // Save client sent kvs + c[subSys][tgt] = kvs - _, ok = c[subSys][tgt].Lookup(State) + _, ok := c[subSys][tgt].Lookup(State) if !ok { // implicit state "on" if not specified. c[subSys][tgt] = append(c[subSys][tgt], KV{ diff --git a/cmd/config/notify/parse.go b/cmd/config/notify/parse.go index f83f9447e..abba0e058 100644 --- a/cmd/config/notify/parse.go +++ b/cmd/config/notify/parse.go @@ -564,6 +564,7 @@ func GetNotifyMQTT(mqttKVS map[string]config.KVS, rootCAs *x509.CertPool) (map[s if k != config.Default { brokerEnv = brokerEnv + config.Default + k } + brokerURL, err := xnet.ParseURL(env.Get(brokerEnv, kv.Get(target.MqttBroker))) if err != nil { return nil, err