Secrets: Move license check to secret store plugin (#53185)

* Move license check to secret store plugin

* Use shouldUseRemoteSecretsPlugin for migration

* Encapsulate plugin startup logic in sync.Once

* Remove global logger from startup functions

* Fix issues with wire and secrets plugin check

* Remove todo for plugin fatal error

* Rename fatalErr variable to be less confusing

* Fix merge conflicts

* Fix issue with grafana-cli wire and opentsdb

* Remove duplicated import on remote plugin

* Rename plugin check in favor of error return value

* Remove unnecessary import on grafana-cli wireexts_oss

* Remove unnecessary import on grafana wireexts_oss

* Reset sync.Once during test setup

* Remove unrelated opentsdb change on grafana-cli wire

* Readd opentsdb change on grafana-cli wire
This commit is contained in:
Guilherme Caulada
2022-08-10 16:47:03 -03:00
committed by GitHub
parent 92d0420a45
commit 7924d3b3b5
13 changed files with 145 additions and 133 deletions
+3 -1
View File
@@ -11,6 +11,7 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/licensing"
"github.com/grafana/grafana/pkg/services/pluginsettings"
"github.com/grafana/grafana/pkg/services/secrets/kvstore"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tsdb/grafanads"
"github.com/grafana/grafana/pkg/util"
@@ -87,6 +88,7 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *models.ReqContext) (map[string]i
}
hasAccess := accesscontrol.HasAccess(hs.AccessControl, c)
secretsManagerPluginEnabled := kvstore.EvaluateRemoteSecretsPlugin(hs.secretsPluginManager, hs.Cfg) == nil
jsonObj := map[string]interface{}{
"defaultDatasource": defaultDS,
@@ -154,7 +156,7 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *models.ReqContext) (map[string]i
"featureToggles": hs.Features.GetEnabled(c.Req.Context()),
"rendererAvailable": hs.RenderService.IsAvailable(),
"rendererVersion": hs.RenderService.Version(),
"secretsManagerPluginEnabled": hs.remoteSecretsCheck.ShouldUseRemoteSecretsPlugin(),
"secretsManagerPluginEnabled": secretsManagerPluginEnabled,
"http2Enabled": hs.Cfg.Protocol == setting.HTTP2Scheme,
"sentry": hs.Cfg.Sentry,
"grafanaJavascriptAgent": hs.Cfg.GrafanaJavascriptAgent,