mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Settings: Actually deprecate access to feature flags (#78073)
This commit is contained in:
@@ -27,7 +27,7 @@ type config struct {
|
||||
logLevel int
|
||||
}
|
||||
|
||||
func newConfig(cfg *setting.Cfg) *config {
|
||||
func newConfig(cfg *setting.Cfg, features featuremgmt.FeatureToggles) *config {
|
||||
defaultLogLevel := 0
|
||||
ip := net.ParseIP(cfg.HTTPAddr)
|
||||
apiURL := cfg.AppURL
|
||||
@@ -46,7 +46,7 @@ func newConfig(cfg *setting.Cfg) *config {
|
||||
host := fmt.Sprintf("%s:%d", ip, port)
|
||||
|
||||
return &config{
|
||||
enabled: cfg.IsFeatureToggleEnabled(featuremgmt.FlagGrafanaAPIServer),
|
||||
enabled: features.IsEnabled(featuremgmt.FlagGrafanaAPIServer),
|
||||
devMode: cfg.Env == setting.Dev,
|
||||
dataPath: filepath.Join(cfg.DataPath, "grafana-apiserver"),
|
||||
ip: ip,
|
||||
|
||||
@@ -11,8 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestNewConfig(t *testing.T) {
|
||||
// nolint:staticcheck
|
||||
cfg := setting.NewCfgWithFeatures(featuremgmt.WithFeatures(featuremgmt.FlagGrafanaAPIServer).IsEnabled)
|
||||
cfg := setting.NewCfg()
|
||||
cfg.Env = setting.Prod
|
||||
cfg.DataPath = "/tmp/grafana"
|
||||
cfg.HTTPAddr = "10.0.0.1"
|
||||
@@ -23,7 +22,7 @@ func TestNewConfig(t *testing.T) {
|
||||
section.Key("log_level").SetValue("5")
|
||||
section.Key("etcd_servers").SetValue("http://localhost:2379")
|
||||
|
||||
actual := newConfig(cfg)
|
||||
actual := newConfig(cfg, featuremgmt.WithFeatures(featuremgmt.FlagGrafanaAPIServer))
|
||||
|
||||
expected := &config{
|
||||
enabled: true,
|
||||
|
||||
@@ -34,6 +34,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/modules"
|
||||
"github.com/grafana/grafana/pkg/registry"
|
||||
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
filestorage "github.com/grafana/grafana/pkg/services/grafana-apiserver/storage/file"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
@@ -113,12 +114,13 @@ type service struct {
|
||||
|
||||
func ProvideService(
|
||||
cfg *setting.Cfg,
|
||||
features featuremgmt.FeatureToggles,
|
||||
rr routing.RouteRegister,
|
||||
authz authorizer.Authorizer,
|
||||
tracing *tracing.TracingService,
|
||||
) (*service, error) {
|
||||
s := &service{
|
||||
config: newConfig(cfg),
|
||||
config: newConfig(cfg, features),
|
||||
rr: rr,
|
||||
stopCh: make(chan struct{}),
|
||||
builders: []APIGroupBuilder{},
|
||||
|
||||
Reference in New Issue
Block a user