From 7e5ce976681e99be6b26d428935ba1106d530efa Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 12 Jan 2018 08:02:11 -0600 Subject: Remove global cfg vars (#8099) * remove global cfg vars * enterprise update --- cmd/platform/mattermost_test.go | 3 ++- cmd/platform/message_export_test.go | 9 +++++---- cmd/platform/server.go | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'cmd') diff --git a/cmd/platform/mattermost_test.go b/cmd/platform/mattermost_test.go index eba45801a..7246d620f 100644 --- a/cmd/platform/mattermost_test.go +++ b/cmd/platform/mattermost_test.go @@ -20,7 +20,8 @@ func TestConfigFlag(t *testing.T) { defer os.RemoveAll(dir) utils.TranslationsPreInit() - config := utils.LoadGlobalConfig("config.json") + config, _, err := utils.LoadConfig("config.json") + require.Nil(t, err) configPath := filepath.Join(dir, "foo.json") require.NoError(t, ioutil.WriteFile(configPath, []byte(config.ToJson()), 0600)) diff --git a/cmd/platform/message_export_test.go b/cmd/platform/message_export_test.go index 211c1ca3c..386aa4268 100644 --- a/cmd/platform/message_export_test.go +++ b/cmd/platform/message_export_test.go @@ -4,15 +4,15 @@ package main import ( - "testing" - "io/ioutil" "os" "path/filepath" + "testing" + + "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/model" "github.com/mattermost/mattermost-server/utils" - "github.com/stretchr/testify/require" ) // There are no tests that actually run the Message Export job, because it can take a long time to complete depending @@ -56,7 +56,8 @@ func writeTempConfig(t *testing.T, isMessageExportEnabled bool) string { require.NoError(t, err) utils.TranslationsPreInit() - config := utils.LoadGlobalConfig("config.json") + config, _, appErr := utils.LoadConfig("config.json") + require.Nil(t, appErr) config.MessageExportSettings.EnableExport = model.NewBool(isMessageExportEnabled) configPath := filepath.Join(dir, "foo.json") require.NoError(t, ioutil.WriteFile(configPath, []byte(config.ToJson()), 0600)) diff --git a/cmd/platform/server.go b/cmd/platform/server.go index cdf12cf71..e36abdaf9 100644 --- a/cmd/platform/server.go +++ b/cmd/platform/server.go @@ -75,7 +75,7 @@ func runServer(configFileLocation string, disableConfigWatch bool) { } a.InitPlugins(*a.Config().PluginSettings.Directory, *a.Config().PluginSettings.ClientDirectory, nil) - utils.AddConfigListener(func(prevCfg, cfg *model.Config) { + a.AddConfigListener(func(prevCfg, cfg *model.Config) { if *cfg.PluginSettings.Enable { a.InitPlugins(*cfg.PluginSettings.Directory, *a.Config().PluginSettings.ClientDirectory, nil) } else { -- cgit v1.2.3-1-g7c22