2020-01-07 00:08:24 +03:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
|
// See LICENSE.txt for license information.
|
|
|
|
|
|
|
|
|
|
package plugin
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
|
|
|
|
|
|
"github.com/mattermost/mattermost-server/v5/model"
|
|
|
|
|
"github.com/mattermost/mattermost-server/v5/utils"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// CheckRequiredServerConfiguration implements Helpers.CheckRequiredServerConfiguration
|
|
|
|
|
func (p *HelpersImpl) CheckRequiredServerConfiguration(req *model.Config) (bool, error) {
|
|
|
|
|
if req == nil {
|
|
|
|
|
return true, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cfg := p.API.GetConfig()
|
|
|
|
|
|
2020-01-29 22:41:25 +03:00
|
|
|
mc, err := utils.Merge(cfg, req, nil)
|
2020-01-07 00:08:24 +03:00
|
|
|
if err != nil {
|
|
|
|
|
return false, errors.Wrap(err, "could not merge configurations")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mergedCfg := mc.(model.Config)
|
|
|
|
|
if mergedCfg.ToJson() != cfg.ToJson() {
|
|
|
|
|
return false, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true, nil
|
|
|
|
|
}
|