Plugins: Make grafana-com API URL usage consistent (#86920)

Plugins: Fix grafana-com API URL usage
This commit is contained in:
Hugo Kiyodi Oshiro
2024-04-26 16:47:38 +02:00
committed by GitHub
parent 85c23eed38
commit 7783b16e47
8 changed files with 13 additions and 13 deletions
@@ -62,7 +62,7 @@ func ProvideDynamic(cfg *setting.Cfg, store angularpatternsstore.Service) (*Dyna
log: log.New("plugin.angulardetectorsprovider.dynamic"),
store: store,
httpClient: makeHttpClient(),
baseURL: cfg.GrafanaComURL,
baseURL: cfg.GrafanaComAPIURL,
backgroundJobInterval: backgroundJobInterval,
}
d.log.Debug("Providing dynamic angular detection patterns", "baseURL", d.baseURL, "interval", d.backgroundJobInterval)
@@ -580,7 +580,7 @@ func provideDynamic(t *testing.T, gcomURL string, opts ...provideDynamicOpts) *D
if opt.cfg == nil {
opt.cfg = setting.NewCfg()
}
opt.cfg.GrafanaComURL = gcomURL
opt.cfg.GrafanaComAPIURL = gcomURL + "/api"
d, err := ProvideDynamic(opt.cfg, opt.store)
require.NoError(t, err)
return d
@@ -9,7 +9,7 @@ import (
)
// gcomAngularPatternsPath is the relative path to the GCOM API handler that returns angular detection patterns.
const gcomAngularPatternsPath = "/api/plugins/angular_patterns"
const gcomAngularPatternsPath = "/plugins/angular_patterns"
// GCOMPatternType is a pattern type returned by the GCOM API.
type GCOMPatternType string
@@ -115,7 +115,7 @@ func (kr *KeyRetriever) downloadKeys(ctx context.Context) error {
Items []ManifestKeys
}
url, err := url.JoinPath(kr.cfg.GrafanaComURL, "/api/plugins/ci/keys") // nolint:gosec URL is provided by config
url, err := url.JoinPath(kr.cfg.GrafanaComAPIURL, "/plugins/ci/keys") // nolint:gosec URL is provided by config
if err != nil {
return err
}
@@ -45,7 +45,7 @@ func Test_PublicKeyUpdate(t *testing.T) {
cfg := &setting.Cfg{}
expectedKey := "fake"
s, done := setFakeAPIServer(t, expectedKey, "7e4d0c6a708866e7")
cfg.GrafanaComURL = s.URL
cfg.GrafanaComAPIURL = s.URL + "/api"
v := ProvideService(cfg, keystore.ProvideService(kvstore.NewFakeKVStore()))
go func() {
err := v.Run(context.Background())
@@ -66,7 +66,7 @@ func Test_PublicKeyUpdate(t *testing.T) {
cfg := &setting.Cfg{}
expectedKey := "fake"
s, done := setFakeAPIServer(t, expectedKey, "7e4d0c6a708866e7")
cfg.GrafanaComURL = s.URL
cfg.GrafanaComAPIURL = s.URL + "/api"
v := ProvideService(cfg, keystore.ProvideService(kvstore.NewFakeKVStore()))
go func() {
err := v.Run(context.Background())
@@ -86,7 +86,7 @@ func Test_PublicKeyUpdate(t *testing.T) {
cfg := &setting.Cfg{}
expectedKey := "fake"
s, done := setFakeAPIServer(t, expectedKey, "other")
cfg.GrafanaComURL = s.URL
cfg.GrafanaComAPIURL = s.URL + "/api"
v := ProvideService(cfg, keystore.ProvideService(kvstore.NewFakeKVStore()))
go func() {
err := v.Run(context.Background())
@@ -113,7 +113,7 @@ func Test_PublicKeyUpdate(t *testing.T) {
}
expectedKey := "fake"
s, done := setFakeAPIServer(t, expectedKey, "7e4d0c6a708866e7")
cfg.GrafanaComURL = s.URL
cfg.GrafanaComAPIURL = s.URL + "/api"
v := ProvideService(cfg, keystore.ProvideService(kvstore.NewFakeKVStore()))
// Simulate an updated key
err := v.kv.SetLastUpdated(context.Background())
@@ -34,7 +34,7 @@ func ProvidePluginManagementConfig(cfg *setting.Cfg, settingProvider setting.Pro
SkipHostEnvVarsEnabled: features.IsEnabledGlobally(featuremgmt.FlagPluginsSkipHostEnvVars),
},
cfg.AngularSupportEnabled,
cfg.GrafanaComURL,
cfg.GrafanaComAPIURL,
cfg.DisablePlugins,
cfg.HideAngularDeprecation,
cfg.ForwardHostEnvVars,