MM-16725 Respect env var overrides when setting config (#11821)

* Respect env var overrides when setting config

* Use strings.NewReader
Этот коммит содержится в:
Joram Wilander
2019-08-09 11:33:59 -04:00
коммит произвёл GitHub
родитель 9ea0a60d88
Коммит 404c49f62f
15 изменённых файлов: 85 добавлений и 23 удалений

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

@@ -64,7 +64,7 @@ func UseTestStore(store store.Store) {
func setupTestHelper(enterprise bool, updateConfig func(*model.Config)) *TestHelper {
testStore.DropAllTables()
memoryStore, err := config.NewMemoryStore()
memoryStore, err := config.NewMemoryStoreWithOptions(&config.MemoryStoreOptions{IgnoreEnvironmentOverrides: true})
if err != nil {
panic("failed to initialize memory store: " + err.Error())
}

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

@@ -234,6 +234,7 @@ func TestGetEnvironmentConfig(t *testing.T) {
os.Setenv("MM_SERVICESETTINGS_SITEURL", "http://example.mattermost.com")
os.Setenv("MM_SERVICESETTINGS_ENABLECUSTOMEMOJI", "true")
defer os.Unsetenv("MM_SERVICESETTINGS_SITEURL")
defer os.Unsetenv("MM_SERVICESETTINGS_ENABLECUSTOMEMOJI")
th := Setup().InitBasic()
defer th.TearDown()

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

@@ -36,7 +36,7 @@ func setupTestHelper(enterprise bool, tb testing.TB) *TestHelper {
store := mainHelper.GetStore()
store.DropAllTables()
memoryStore, err := config.NewMemoryStore()
memoryStore, err := config.NewMemoryStoreWithOptions(&config.MemoryStoreOptions{IgnoreEnvironmentOverrides: true})
if err != nil {
panic("failed to initialize memory store: " + err.Error())
}

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

@@ -383,7 +383,7 @@ func TestPluginAPIGetPluginConfig(t *testing.T) {
api := NewPluginAPI(th.App, manifest)
pluginConfigJsonString := `{"mystringsetting": "str", "MyIntSetting": 32, "myboolsetting": true}`
pluginConfigJsonString := `{"mystringsetting": "str", "myintsetting": 32, "myboolsetting": true}`
var pluginConfig map[string]interface{}
if err := json.Unmarshal([]byte(pluginConfigJsonString), &pluginConfig); err != nil {

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

@@ -6,6 +6,7 @@ package config
import (
"bytes"
"io"
"strings"
"sync"
"github.com/mattermost/mattermost-server/model"
@@ -42,7 +43,7 @@ func (cs *commonStore) GetEnvironmentOverrides() map[string]interface{} {
// using the persist function argument.
//
// This function assumes no lock has been acquired, as it acquires a write lock itself.
func (cs *commonStore) set(newCfg *model.Config, validate func(*model.Config) error, persist func(*model.Config) error) (*model.Config, error) {
func (cs *commonStore) set(newCfg *model.Config, allowEnvironmentOverrides bool, validate func(*model.Config) error, persist func(*model.Config) error) (*model.Config, error) {
cs.configLock.Lock()
var unlockOnce sync.Once
defer unlockOnce.Do(cs.configLock.Unlock)
@@ -56,7 +57,14 @@ func (cs *commonStore) set(newCfg *model.Config, validate func(*model.Config) er
// return nil, errors.New("old configuration modified instead of cloning")
// }
newCfg = newCfg.Clone()
// To both clone and re-apply the environment variable overrides we marshal and then
// unmarshal the config again.
var err error
newCfg, _, err = unmarshalConfig(strings.NewReader(newCfg.ToJson()), allowEnvironmentOverrides)
if err != nil {
return nil, errors.Wrapf(err, "failed to unmarshal config with env overrides")
}
newCfg.SetDefaults()
// Sometimes the config is received with "fake" data in sensitive fields. Apply the real

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

@@ -1,6 +1,7 @@
package config_test
import (
"os"
"testing"
"github.com/mattermost/mattermost-server/config"
@@ -134,5 +135,29 @@ func TestMergeConfigs(t *testing.T) {
})
}
func TestConfigEnvironmentOverrides(t *testing.T) {
base, err := config.NewMemoryStore()
require.NoError(t, err)
originalConfig := &model.Config{}
originalConfig.ServiceSettings.SiteURL = newString("http://notoverriden.ca")
os.Setenv("MM_SERVICESETTINGS_SITEURL", "http://overridden.ca")
defer os.Unsetenv("MM_SERVICESETTINGS_SITEURL")
t.Run("loading config should respect environment variable overrides", func(t *testing.T) {
err := base.Load()
require.NoError(t, err)
assert.Equal(t, "http://overridden.ca", *base.Get().ServiceSettings.SiteURL)
})
t.Run("setting config should respect environment variable overrides", func(t *testing.T) {
_, err := base.Set(originalConfig)
require.NoError(t, err)
assert.Equal(t, "http://overridden.ca", *base.Get().ServiceSettings.SiteURL)
})
}
func newBool(b bool) *bool { return &b }
func newString(s string) *string { return &s }

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

@@ -125,7 +125,7 @@ func parseDSN(dsn string) (string, string, error) {
// Set replaces the current configuration in its entirety and updates the backing store.
func (ds *DatabaseStore) Set(newCfg *model.Config) (*model.Config, error) {
return ds.commonStore.set(newCfg, ds.commonStore.validate, ds.persist)
return ds.commonStore.set(newCfg, true, ds.commonStore.validate, ds.persist)
}
// persist writes the configuration to the configured database.

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

@@ -178,6 +178,7 @@ func TestDatabaseStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, ds.GetEnvironmentOverrides())
os.Setenv("MM_SERVICESETTINGS_SITEURL", "http://override")
defer os.Unsetenv("MM_SERVICESETTINGS_SITEURL")
ds, err = config.NewDatabaseStore(fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource))
require.NoError(t, err)
@@ -200,6 +201,7 @@ func TestDatabaseStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, ds.GetEnvironmentOverrides())
os.Setenv("MM_PLUGINSETTINGS_ENABLEUPLOADS", "true")
defer os.Unsetenv("MM_PLUGINSETTINGS_ENABLEUPLOADS")
ds, err = config.NewDatabaseStore(fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource))
require.NoError(t, err)
@@ -222,6 +224,7 @@ func TestDatabaseStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, ds.GetEnvironmentOverrides())
os.Setenv("MM_TEAMSETTINGS_MAXUSERSPERTEAM", "3000")
defer os.Unsetenv("MM_TEAMSETTINGS_MAXUSERSPERTEAM")
ds, err = config.NewDatabaseStore(fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource))
require.NoError(t, err)
@@ -244,6 +247,7 @@ func TestDatabaseStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, ds.GetEnvironmentOverrides())
os.Setenv("MM_SERVICESETTINGS_TLSSTRICTTRANSPORTMAXAGE", "123456")
defer os.Unsetenv("MM_SERVICESETTINGS_TLSSTRICTTRANSPORTMAXAGE")
ds, err = config.NewDatabaseStore(fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource))
require.NoError(t, err)
@@ -266,6 +270,7 @@ func TestDatabaseStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, ds.GetEnvironmentOverrides())
os.Setenv("MM_SQLSETTINGS_DATASOURCEREPLICAS", "user:pwd@db:5432/test-db")
defer os.Unsetenv("MM_SQLSETTINGS_DATASOURCEREPLICAS")
ds, err = config.NewDatabaseStore(fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource))
require.NoError(t, err)
@@ -291,6 +296,7 @@ func TestDatabaseStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, ds.GetEnvironmentOverrides())
os.Setenv("MM_SQLSETTINGS_DATASOURCEREPLICAS", "user:pwd@db:5432/test-db user:pwd@db2:5433/test-db2 user:pwd@db3:5434/test-db3")
defer os.Unsetenv("MM_SQLSETTINGS_DATASOURCEREPLICAS")
ds, err = config.NewDatabaseStore(fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource))
require.NoError(t, err)
@@ -525,6 +531,7 @@ func TestDatabaseStoreLoad(t *testing.T) {
assert.Equal(t, "http://minimal", *ds.Get().ServiceSettings.SiteURL)
os.Setenv("MM_SERVICESETTINGS_SITEURL", "http://override")
defer os.Unsetenv("MM_SERVICESETTINGS_SITEURL")
err = ds.Load()
require.NoError(t, err)
@@ -537,6 +544,7 @@ func TestDatabaseStoreLoad(t *testing.T) {
defer tearDown()
os.Setenv("MM_SERVICESETTINGS_SITEURL", "http://overridePersistEnvVariables")
defer os.Unsetenv("MM_SERVICESETTINGS_SITEURL")
ds, err := config.NewDatabaseStore(fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource))
require.NoError(t, err)
@@ -557,6 +565,7 @@ func TestDatabaseStoreLoad(t *testing.T) {
defer tearDown()
os.Setenv("MM_PLUGINSETTINGS_ENABLEUPLOADS", "true")
defer os.Unsetenv("MM_PLUGINSETTINGS_ENABLEUPLOADS")
ds, err := config.NewDatabaseStore(fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource))
require.NoError(t, err)
@@ -579,6 +588,7 @@ func TestDatabaseStoreLoad(t *testing.T) {
defer tearDown()
os.Setenv("MM_TEAMSETTINGS_MAXUSERSPERTEAM", "3000")
defer os.Unsetenv("MM_TEAMSETTINGS_MAXUSERSPERTEAM")
ds, err := config.NewDatabaseStore(fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource))
require.NoError(t, err)
@@ -601,6 +611,7 @@ func TestDatabaseStoreLoad(t *testing.T) {
defer tearDown()
os.Setenv("MM_SERVICESETTINGS_TLSSTRICTTRANSPORTMAXAGE", "123456")
defer os.Unsetenv("MM_SERVICESETTINGS_TLSSTRICTTRANSPORTMAXAGE")
ds, err := config.NewDatabaseStore(fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource))
require.NoError(t, err)
@@ -623,6 +634,7 @@ func TestDatabaseStoreLoad(t *testing.T) {
defer tearDown()
os.Setenv("MM_SQLSETTINGS_DATASOURCEREPLICAS", "user:pwd@db:5432/test-db")
defer os.Unsetenv("MM_SQLSETTINGS_DATASOURCEREPLICAS")
ds, err := config.NewDatabaseStore(fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource))
require.NoError(t, err)
@@ -647,6 +659,7 @@ func TestDatabaseStoreLoad(t *testing.T) {
defer tearDown()
os.Setenv("MM_SQLSETTINGS_DATASOURCEREPLICAS", "user:pwd@db:5432/test-db")
defer os.Unsetenv("MM_SQLSETTINGS_DATASOURCEREPLICAS")
ds, err := config.NewDatabaseStore(fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource))
require.NoError(t, err)

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

@@ -94,7 +94,7 @@ func resolveConfigFilePath(path string) (string, error) {
// Set replaces the current configuration in its entirety and updates the backing store.
func (fs *FileStore) Set(newCfg *model.Config) (*model.Config, error) {
return fs.commonStore.set(newCfg, func(cfg *model.Config) error {
return fs.commonStore.set(newCfg, true, func(cfg *model.Config) error {
if *fs.config.ClusterSettings.Enable && *fs.config.ClusterSettings.ReadOnlyConfig {
return ErrReadOnlyConfiguration
}

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

@@ -216,6 +216,7 @@ func TestFileStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, fs.GetEnvironmentOverrides())
os.Setenv("MM_SERVICESETTINGS_SITEURL", "http://override")
defer os.Unsetenv("MM_SERVICESETTINGS_SITEURL")
fs, err = config.NewFileStore(path, false)
require.NoError(t, err)
@@ -237,6 +238,7 @@ func TestFileStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, fs.GetEnvironmentOverrides())
os.Setenv("MM_PLUGINSETTINGS_ENABLEUPLOADS", "true")
defer os.Unsetenv("MM_PLUGINSETTINGS_ENABLEUPLOADS")
fs, err = config.NewFileStore(path, false)
require.NoError(t, err)
@@ -258,6 +260,7 @@ func TestFileStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, fs.GetEnvironmentOverrides())
os.Setenv("MM_TEAMSETTINGS_MAXUSERSPERTEAM", "3000")
defer os.Unsetenv("MM_TEAMSETTINGS_MAXUSERSPERTEAM")
fs, err = config.NewFileStore(path, false)
require.NoError(t, err)
@@ -279,6 +282,7 @@ func TestFileStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, fs.GetEnvironmentOverrides())
os.Setenv("MM_SERVICESETTINGS_TLSSTRICTTRANSPORTMAXAGE", "123456")
defer os.Unsetenv("MM_SERVICESETTINGS_TLSSTRICTTRANSPORTMAXAGE")
fs, err = config.NewFileStore(path, false)
require.NoError(t, err)
@@ -300,6 +304,7 @@ func TestFileStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, fs.GetEnvironmentOverrides())
os.Setenv("MM_SQLSETTINGS_DATASOURCEREPLICAS", "user:pwd@db:5432/test-db")
defer os.Unsetenv("MM_SQLSETTINGS_DATASOURCEREPLICAS")
fs, err = config.NewFileStore(path, false)
require.NoError(t, err)
@@ -324,6 +329,7 @@ func TestFileStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, fs.GetEnvironmentOverrides())
os.Setenv("MM_SQLSETTINGS_DATASOURCEREPLICAS", "user:pwd@db:5432/test-db user:pwd@db2:5433/test-db2 user:pwd@db3:5434/test-db3")
defer os.Unsetenv("MM_SQLSETTINGS_DATASOURCEREPLICAS")
fs, err = config.NewFileStore(path, false)
require.NoError(t, err)
@@ -541,6 +547,7 @@ func TestFileStoreLoad(t *testing.T) {
assert.Equal(t, "http://minimal", *fs.Get().ServiceSettings.SiteURL)
os.Setenv("MM_SERVICESETTINGS_SITEURL", "http://override")
defer os.Unsetenv("MM_SERVICESETTINGS_SITEURL")
err = fs.Load()
require.NoError(t, err)
@@ -553,6 +560,7 @@ func TestFileStoreLoad(t *testing.T) {
defer tearDown()
os.Setenv("MM_SERVICESETTINGS_SITEURL", "http://overridePersistEnvVariables")
defer os.Unsetenv("MM_SERVICESETTINGS_SITEURL")
fs, err := config.NewFileStore(path, false)
require.NoError(t, err)
@@ -575,6 +583,7 @@ func TestFileStoreLoad(t *testing.T) {
defer tearDown()
os.Setenv("MM_PLUGINSETTINGS_ENABLEUPLOADS", "true")
defer os.Unsetenv("MM_PLUGINSETTINGS_ENABLEUPLOADS")
fs, err := config.NewFileStore(path, false)
require.NoError(t, err)
@@ -597,6 +606,7 @@ func TestFileStoreLoad(t *testing.T) {
defer tearDown()
os.Setenv("MM_TEAMSETTINGS_MAXUSERSPERTEAM", "3000")
defer os.Unsetenv("MM_TEAMSETTINGS_MAXUSERSPERTEAM")
fs, err := config.NewFileStore(path, false)
require.NoError(t, err)
@@ -619,6 +629,7 @@ func TestFileStoreLoad(t *testing.T) {
defer tearDown()
os.Setenv("MM_SERVICESETTINGS_TLSSTRICTTRANSPORTMAXAGE", "123456")
defer os.Unsetenv("MM_SERVICESETTINGS_TLSSTRICTTRANSPORTMAXAGE")
fs, err := config.NewFileStore(path, false)
require.NoError(t, err)
@@ -641,6 +652,7 @@ func TestFileStoreLoad(t *testing.T) {
defer tearDown()
os.Setenv("MM_SQLSETTINGS_DATASOURCEREPLICAS", "user:pwd@db:5432/test-db")
defer os.Unsetenv("MM_SQLSETTINGS_DATASOURCEREPLICAS")
fs, err := config.NewFileStore(path, false)
require.NoError(t, err)
@@ -665,6 +677,7 @@ func TestFileStoreLoad(t *testing.T) {
defer tearDown()
os.Setenv("MM_SQLSETTINGS_DATASOURCEREPLICAS", "user:pwd@db:5432/test-db")
defer os.Unsetenv("MM_SQLSETTINGS_DATASOURCEREPLICAS")
fs, err := config.NewFileStore(path, false)
require.NoError(t, err)

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

@@ -73,7 +73,7 @@ func (ms *memoryStore) Set(newCfg *model.Config) (*model.Config, error) {
validate = nil
}
return ms.commonStore.set(newCfg, validate, ms.persist)
return ms.commonStore.set(newCfg, ms.allowEnvironmentOverrides, validate, ms.persist)
}
// persist copies the active config to the saved config.

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

@@ -94,6 +94,7 @@ func TestMemoryStoreGetEnivironmentOverrides(t *testing.T) {
assert.Empty(t, ms.GetEnvironmentOverrides())
os.Setenv("MM_SERVICESETTINGS_SITEURL", "http://override")
defer os.Unsetenv("MM_SERVICESETTINGS_SITEURL")
ms, err = config.NewMemoryStore()
require.NoError(t, err)
@@ -231,6 +232,7 @@ func TestMemoryStoreLoad(t *testing.T) {
defer ms.Close()
os.Setenv("MM_SERVICESETTINGS_SITEURL", "http://override")
defer os.Unsetenv("MM_SERVICESETTINGS_SITEURL")
err = ms.Load()
require.NoError(t, err)

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

@@ -32,7 +32,7 @@ func setupTestHelper(enterprise bool) *TestHelper {
store := mainHelper.GetStore()
store.DropAllTables()
memoryStore, err := config.NewMemoryStore()
memoryStore, err := config.NewMemoryStoreWithOptions(&config.MemoryStoreOptions{IgnoreEnvironmentOverrides: true})
if err != nil {
panic("failed to initialize memory store: " + err.Error())
}

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

@@ -248,7 +248,7 @@ type ServiceSettings struct {
EnableIncomingWebhooks *bool
EnableOutgoingWebhooks *bool
EnableCommands *bool
DEPRECATED_DO_NOT_USE_EnableOnlyAdminIntegrations *bool `json:"EnableOnlyAdminIntegrations"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_EnableOnlyAdminIntegrations *bool `json:"EnableOnlyAdminIntegrations" mapstructure:"EnableOnlyAdminIntegrations"` // This field is deprecated and must not be used.
EnablePostUsernameOverride *bool
EnablePostIconOverride *bool
EnableLinkPreviews *bool
@@ -278,9 +278,9 @@ type ServiceSettings struct {
EnableGifPicker *bool
GfycatApiKey *string
GfycatApiSecret *string
DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation *string `json:"RestrictCustomEmojiCreation"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPostDelete *string `json:"RestrictPostDelete"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_AllowEditPost *string `json:"AllowEditPost"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation *string `json:"RestrictCustomEmojiCreation" mapstructure:"RestrictCustomEmojiCreation"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPostDelete *string `json:"RestrictPostDelete" mapstructure:"RestrictPostDelete"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_AllowEditPost *string `json:"AllowEditPost" mapstructure:"AllowEditPost"` // This field is deprecated and must not be used.
PostEditTimeLimit *int
TimeBetweenUserTypingUpdatesMilliseconds *int64 `restricted:"true"`
EnablePostSearch *bool `restricted:"true"`
@@ -1468,7 +1468,7 @@ func (s *ThemeSettings) SetDefaults() {
type TeamSettings struct {
SiteName *string
MaxUsersPerTeam *int
DEPRECATED_DO_NOT_USE_EnableTeamCreation *bool `json:"EnableTeamCreation"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_EnableTeamCreation *bool `json:"EnableTeamCreation" mapstructure:"EnableTeamCreation"` // This field is deprecated and must not be used.
EnableUserCreation *bool
EnableOpenServer *bool
EnableUserDeactivation *bool
@@ -1477,14 +1477,14 @@ type TeamSettings struct {
CustomBrandText *string
CustomDescriptionText *string
RestrictDirectMessage *string
DEPRECATED_DO_NOT_USE_RestrictTeamInvite *string `json:"RestrictTeamInvite"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement *string `json:"RestrictPublicChannelManagement"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement *string `json:"RestrictPrivateChannelManagement"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPublicChannelCreation *string `json:"RestrictPublicChannelCreation"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPrivateChannelCreation *string `json:"RestrictPrivateChannelCreation"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPublicChannelDeletion *string `json:"RestrictPublicChannelDeletion"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPrivateChannelDeletion *string `json:"RestrictPrivateChannelDeletion"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManageMembers *string `json:"RestrictPrivateChannelManageMembers"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictTeamInvite *string `json:"RestrictTeamInvite" mapstructure:"RestrictTeamInvite"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPublicChannelManagement *string `json:"RestrictPublicChannelManagement" mapstructure:"RestrictPublicChannelManagement"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManagement *string `json:"RestrictPrivateChannelManagement" mapstructure:"RestrictPrivateChannelManagement"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPublicChannelCreation *string `json:"RestrictPublicChannelCreation" mapstructure:"RestrictPublicChannelCreation"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPrivateChannelCreation *string `json:"RestrictPrivateChannelCreation" mapstructure:"RestrictPrivateChannelCreation"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPublicChannelDeletion *string `json:"RestrictPublicChannelDeletion" mapstructure:"RestrictPublicChannelDeletion"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPrivateChannelDeletion *string `json:"RestrictPrivateChannelDeletion" mapstructure:"RestrictPrivateChannelDeletion"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_RestrictPrivateChannelManageMembers *string `json:"RestrictPrivateChannelManageMembers" mapstructure:"RestrictPrivateChannelManageMembers"` // This field is deprecated and must not be used.
EnableXToLeaveChannelsFromLHS *bool
UserStatusAwayTimeout *int64
MaxChannelsPerTeam *int64

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

@@ -44,7 +44,7 @@ func Setup() *TestHelper {
store := mainHelper.GetStore()
store.DropAllTables()
memoryStore, err := config.NewMemoryStore()
memoryStore, err := config.NewMemoryStoreWithOptions(&config.MemoryStoreOptions{IgnoreEnvironmentOverrides: true})
if err != nil {
panic("failed to initialize memory store: " + err.Error())
}