Correctly merge plugin configuration on mmctl config patch (#26647)
* Adds a step to the config patch command to merge plugin configurations * Fix linter --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4e32da62fa
Коммит
bc49f348bf
@@ -377,10 +377,21 @@ func configPatchCmdF(c client.Client, _ *cobra.Command, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// get original plugin map
|
||||
var pluginConfig map[string]map[string]any
|
||||
if config.PluginSettings.Plugins != nil {
|
||||
pluginConfig = (config.Clone()).PluginSettings.Plugins
|
||||
}
|
||||
|
||||
// apply path onto the existing config
|
||||
if jErr := json.Unmarshal(configBytes, config); jErr != nil {
|
||||
return jErr
|
||||
}
|
||||
|
||||
// merge config plugin map on top of the original, and assign the
|
||||
// result to the config key
|
||||
config.PluginSettings.Plugins = MergePluginConfigs(pluginConfig, config.PluginSettings.Plugins)
|
||||
|
||||
newConfig, _, err := c.PatchConfig(context.TODO(), config)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Ссылка в новой задаче
Block a user