MM-21285: Remove environment overrides before config broadcast (#13527)

While sending the config broadcast message across a cluster, we would
include the environment overrides in the config.

We fix this by exposing a config config store method to remove the overrides,
and then calling that before saving the config across the cluster.

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Agniva De Sarker
2020-01-07 23:21:28 +05:30
коммит произвёл GitHub
родитель 62f77d81aa
Коммит ecb41c6eb5
4 изменённых файлов: 20 добавлений и 3 удалений

Просмотреть файл

@@ -77,7 +77,7 @@ func (cs *commonStore) set(newCfg *model.Config, allowEnvironmentOverrides bool,
}
}
if err := persist(cs.removeEnvOverrides(newCfg)); err != nil {
if err := persist(cs.RemoveEnvironmentOverrides(newCfg)); err != nil {
return nil, errors.Wrap(err, "failed to persist")
}
@@ -164,7 +164,7 @@ func (cs *commonStore) validate(cfg *model.Config) error {
return nil
}
// removeEnvOverrides returns a new config without the given environment overrides.
func (cs *commonStore) removeEnvOverrides(cfg *model.Config) *model.Config {
// RemoveEnvironmentOverrides returns a new config without the given environment overrides.
func (cs *commonStore) RemoveEnvironmentOverrides(cfg *model.Config) *model.Config {
return removeEnvOverrides(cfg, cs.configWithoutOverrides, cs.environmentOverrides)
}