Settings: Actually deprecate access to feature flags (#78073)
This commit is contained in:
@@ -153,7 +153,8 @@ func TestMigrations(t *testing.T) {
|
||||
{
|
||||
desc: "with editors can admin",
|
||||
config: &setting.Cfg{
|
||||
EditorsCanAdmin: true,
|
||||
EditorsCanAdmin: true,
|
||||
// nolint:staticcheck
|
||||
IsFeatureToggleEnabled: func(key string) bool { return key == "accesscontrol" },
|
||||
Raw: ini.Empty(),
|
||||
},
|
||||
|
||||
@@ -94,7 +94,9 @@ func (*OSSMigrations) AddMigration(mg *Migrator) {
|
||||
AddExternalAlertmanagerToDatasourceMigration(mg)
|
||||
|
||||
addFolderMigrations(mg)
|
||||
// nolint:staticcheck
|
||||
if mg.Cfg != nil && mg.Cfg.IsFeatureToggleEnabled != nil {
|
||||
// nolint:staticcheck
|
||||
if mg.Cfg.IsFeatureToggleEnabled(featuremgmt.FlagExternalServiceAuth) {
|
||||
oauthserver.AddMigration(mg)
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ func ProvideService(cfg *setting.Cfg, cacheService *localcache.CacheService, mig
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// nolint:staticcheck
|
||||
if err := s.Migrate(cfg.IsFeatureToggleEnabled(featuremgmt.FlagMigrationLocking)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -306,10 +307,12 @@ func (ss *SQLStore) buildConnectionString() (string, error) {
|
||||
cnnstr += fmt.Sprintf("&transaction_isolation=%s", val)
|
||||
}
|
||||
|
||||
// nolint:staticcheck
|
||||
if ss.Cfg.IsFeatureToggleEnabled(featuremgmt.FlagMysqlAnsiQuotes) || ss.Cfg.IsFeatureToggleEnabled(featuremgmt.FlagNewDBLibrary) {
|
||||
cnnstr += "&sql_mode='ANSI_QUOTES'"
|
||||
}
|
||||
|
||||
// nolint:staticcheck
|
||||
if ss.Cfg.IsFeatureToggleEnabled(featuremgmt.FlagNewDBLibrary) {
|
||||
cnnstr += "&parseTime=true"
|
||||
}
|
||||
@@ -638,6 +641,7 @@ func initTestDB(testCfg *setting.Cfg, migration registry.DatabaseMigrator, opts
|
||||
|
||||
// set test db config
|
||||
cfg := setting.NewCfg()
|
||||
// nolint:staticcheck
|
||||
cfg.IsFeatureToggleEnabled = func(key string) bool {
|
||||
for _, enabledFeature := range features {
|
||||
if enabledFeature == key {
|
||||
@@ -732,6 +736,7 @@ func initTestDB(testCfg *setting.Cfg, migration registry.DatabaseMigrator, opts
|
||||
return testSQLStore, nil
|
||||
}
|
||||
|
||||
// nolint:staticcheck
|
||||
testSQLStore.Cfg.IsFeatureToggleEnabled = func(key string) bool {
|
||||
for _, enabledFeature := range features {
|
||||
if enabledFeature == key {
|
||||
|
||||
Reference in New Issue
Block a user