diff --git a/pkg/cmd/grafana-server/commands/cli.go b/pkg/cmd/grafana-server/commands/cli.go index 5f438aad2fd..949c865060a 100644 --- a/pkg/cmd/grafana-server/commands/cli.go +++ b/pkg/cmd/grafana-server/commands/cli.go @@ -11,6 +11,7 @@ import ( "syscall" "time" + "github.com/grafana/grafana/pkg/services/featuremgmt" _ "github.com/grafana/pyroscope-go/godeltaprof/http/pprof" "github.com/urfave/cli/v2" @@ -105,6 +106,11 @@ func RunServer(opts standalone.BuildInfo, cli *cli.Context) error { metrics.SetBuildInformation(metrics.ProvideRegisterer(), opts.Version, opts.Commit, opts.BuildBranch, getBuildstamp(opts)) + // Initialize the OpenFeature feature flag system + if err := featuremgmt.InitOpenFeatureWithCfg(cfg); err != nil { + return err + } + s, err := server.Initialize( cfg, server.Options{ diff --git a/pkg/cmd/grafana-server/commands/target.go b/pkg/cmd/grafana-server/commands/target.go index 39f322396ac..e6988b7e4c5 100644 --- a/pkg/cmd/grafana-server/commands/target.go +++ b/pkg/cmd/grafana-server/commands/target.go @@ -7,6 +7,7 @@ import ( "runtime/debug" "strings" + "github.com/grafana/grafana/pkg/services/featuremgmt" "github.com/urfave/cli/v2" "github.com/grafana/grafana/pkg/api" @@ -91,6 +92,10 @@ func RunTargetServer(opts standalone.BuildInfo, cli *cli.Context) error { metrics.SetBuildInformation(metrics.ProvideRegisterer(), opts.Version, opts.Commit, opts.BuildBranch, getBuildstamp(opts)) + // Initialize the OpenFeature client with the configuration + if err := featuremgmt.InitOpenFeatureWithCfg(cfg); err != nil { + return err + } s, err := server.InitializeModuleServer( cfg, server.Options{ diff --git a/pkg/server/server.go b/pkg/server/server.go index 794cf656763..ca1263d9e4d 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -11,7 +11,6 @@ import ( "strconv" "sync" - "github.com/grafana/grafana/pkg/services/featuremgmt" "golang.org/x/sync/errgroup" "github.com/prometheus/client_golang/prometheus" @@ -132,11 +131,6 @@ func (s *Server) Init() error { return err } - // Initialize the OpenFeature feature flag system - if err := featuremgmt.InitOpenFeatureWithCfg(s.cfg); err != nil { - return err - } - return s.provisioningService.RunInitProvisioners(s.context) }