mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Add app URL to the plugin config (#77455)
This commit is contained in:
committed by
GitHub
parent
34eb29c3bf
commit
00a596b2e0
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/grafana/grafana-aws-sdk/pkg/awsds"
|
||||
"github.com/grafana/grafana-azure-sdk-go/azsettings"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/proxy"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/experimental/featuretoggles"
|
||||
|
||||
@@ -79,6 +80,10 @@ func (s *Service) Get(ctx context.Context, p *plugins.Plugin) []string {
|
||||
func (s *Service) GetConfigMap(ctx context.Context, _ string, _ *auth.ExternalService) map[string]string {
|
||||
m := make(map[string]string)
|
||||
|
||||
if s.cfg.GrafanaAppURL != "" {
|
||||
m[backend.AppURL] = s.cfg.GrafanaAppURL
|
||||
}
|
||||
|
||||
// TODO add support via plugin SDK
|
||||
//if externalService != nil {
|
||||
// m[oauthtokenretriever.AppURL] = s.cfg.GrafanaAppURL
|
||||
|
||||
@@ -500,3 +500,14 @@ func TestService_GetConfigMap_featureToggles(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestService_GetConfigMap_appURL(t *testing.T) {
|
||||
t.Run("Uses the configured app URL", func(t *testing.T) {
|
||||
s := &Service{
|
||||
cfg: &config.Cfg{
|
||||
GrafanaAppURL: "https://myorg.com/",
|
||||
},
|
||||
}
|
||||
require.Equal(t, map[string]string{"GF_APP_URL": "https://myorg.com/"}, s.GetConfigMap(context.Background(), "", nil))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user