diff --git a/pkg/cmd/grafana/apiserver/cmd.go b/pkg/cmd/grafana/apiserver/cmd.go index bfa7e532a46..a7a621adad7 100644 --- a/pkg/cmd/grafana/apiserver/cmd.go +++ b/pkg/cmd/grafana/apiserver/cmd.go @@ -62,7 +62,10 @@ func newCommandStartExampleAPIServer(o *APIServerOptions, stopCh <-chan struct{} } cmd.Flags().StringVar(&runtimeConfig, "runtime-config", "", "A set of key=value pairs that enable or disable built-in APIs.") - o.factory.GetOptions().AddFlags(cmd.Flags()) + + if factoryOptions := o.factory.GetOptions(); factoryOptions != nil { + factoryOptions.AddFlags(cmd.Flags()) + } // Register standard k8s flags with the command line o.RecommendedOptions = options.NewRecommendedOptions(