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")