mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
FeatureFlags: manage feature flags outside of settings.Cfg (#43692)
This commit is contained in:
@@ -37,7 +37,7 @@ func (s *Service) SubscribeStream(_ context.Context, req *backend.SubscribeStrea
|
||||
}
|
||||
}
|
||||
|
||||
if s.cfg.FeatureToggles["live-pipeline"] {
|
||||
if s.features.IsLivePipelineEnabled() {
|
||||
// While developing Live pipeline avoid sending initial data.
|
||||
initialData = nil
|
||||
}
|
||||
@@ -126,7 +126,7 @@ func (s *Service) runTestStream(ctx context.Context, path string, conf testStrea
|
||||
}
|
||||
|
||||
mode := data.IncludeDataOnly
|
||||
if s.cfg.FeatureToggles["live-pipeline"] {
|
||||
if s.features.IsLivePipelineEnabled() {
|
||||
mode = data.IncludeAll
|
||||
}
|
||||
|
||||
|
@@ -10,11 +10,13 @@ import (
|
||||
"github.com/grafana/grafana-plugin-sdk-go/data"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
func ProvideService(cfg *setting.Cfg) *Service {
|
||||
func ProvideService(cfg *setting.Cfg, features *featuremgmt.FeatureToggles) *Service {
|
||||
s := &Service{
|
||||
features: features,
|
||||
queryMux: datasource.NewQueryTypeMux(),
|
||||
scenarios: map[string]*Scenario{},
|
||||
frame: data.NewFrame("testdata",
|
||||
@@ -46,6 +48,7 @@ type Service struct {
|
||||
labelFrame *data.Frame
|
||||
queryMux *datasource.QueryTypeMux
|
||||
resourceHandler backend.CallResourceHandler
|
||||
features *featuremgmt.FeatureToggles
|
||||
}
|
||||
|
||||
func (s *Service) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
|
||||
|
Reference in New Issue
Block a user