Expressions: Add option to disable feature (#30541)

* Expressions: Add option to disable feature

* Apply suggestions from code review

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
Sofia Papagiannaki
2021-01-22 19:27:33 +02:00
committed by GitHub
co-authored by achatterjee-grafana
parent 5d52e50f6f
commit 9ada4b6052
15 changed files with 99 additions and 28 deletions
+9
View File
@@ -4,6 +4,7 @@ import (
"context"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana/pkg/setting"
)
// DatasourceName is the string constant used as the datasource name in requests
@@ -20,6 +21,14 @@ const DatasourceUID = "-100"
// Service is service representation for expression handling.
type Service struct {
Cfg *setting.Cfg
}
func (s *Service) isDisabled() bool {
if s.Cfg == nil {
return true
}
return !s.Cfg.ExpressionsEnabled
}
// BuildPipeline builds a pipeline from a request.