MM-14441: restrict system admin config (#10477)
* tweak utils.Merge docs * move merge_test to utils_test package for easier testing * utils: support MergeConfig and StructFieldFilter * constrain updating certain fields by the restricted system admin
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3d92af2737
Коммит
8c8b1bbc9c
@@ -128,3 +128,15 @@ func FixInvalidLocales(cfg *model.Config) bool {
|
||||
|
||||
return changed
|
||||
}
|
||||
|
||||
// Merge merges two configs together. The receiver's values are overwritten with the patch's
|
||||
// values except when the patch's values are nil.
|
||||
func Merge(cfg *model.Config, patch *model.Config, mergeConfig *utils.MergeConfig) (*model.Config, error) {
|
||||
ret, err := utils.Merge(cfg, patch, mergeConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
retCfg := ret.(model.Config)
|
||||
return &retCfg, nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user