From 07623a70fd046c403d9f7bf4ca18406f9261afb1 Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Mon, 25 Jul 2022 15:23:14 +0530 Subject: [PATCH] MM-45875: Apply environment overrides in cluster scenario (#20694) Automatic Merge --- config/store.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/config/store.go b/config/store.go index 69e5bfa778..a3db0d186c 100644 --- a/config/store.go +++ b/config/store.go @@ -184,6 +184,11 @@ func (s *Store) Set(newCfg *model.Config) (*model.Config, *model.Config, error) // data from the existing config as necessary. desanitize(oldCfg, newCfg) + // We apply back environment overrides since the input config may or + // may not have them applied. + newCfg = applyEnvironmentMap(newCfg, GetEnvironment()) + fixConfig(newCfg) + if err := newCfg.IsValid(); err != nil { return nil, nil, errors.Wrap(err, "new configuration is invalid") } @@ -209,14 +214,6 @@ func (s *Store) Set(newCfg *model.Config) (*model.Config, *model.Config, error) return nil, nil, errors.Wrap(err, "failed to persist") } - // We apply back environment overrides since the input config may or - // may not have them applied. - newCfg = applyEnvironmentMap(newCfgNoEnv, GetEnvironment()) - fixConfig(newCfg) - if err := newCfg.IsValid(); err != nil { - return nil, nil, errors.Wrap(err, "new configuration is invalid") - } - hasChanged, err := equal(oldCfg, newCfg) if err != nil { return nil, nil, errors.Wrap(err, "failed to compare configs")