Plugins: Introduce plugin asset provider (#108063)
* introduce plugin asset provider * simply with PR feedback * fix linter
This commit is contained in:
@@ -21,7 +21,7 @@ func ProvideLicensing(cfg *setting.Cfg, l licensing.Licensing) *Service {
|
||||
}
|
||||
}
|
||||
|
||||
func (l Service) Environment() []string {
|
||||
func (l *Service) Environment() []string {
|
||||
var env []string
|
||||
if envProvider, ok := l.license.(licensing.LicenseEnvironment); ok {
|
||||
for k, v := range envProvider.Environment() {
|
||||
@@ -31,14 +31,18 @@ func (l Service) Environment() []string {
|
||||
return env
|
||||
}
|
||||
|
||||
func (l Service) Edition() string {
|
||||
func (l *Service) Edition() string {
|
||||
return l.license.Edition()
|
||||
}
|
||||
|
||||
func (l Service) Path() string {
|
||||
func (l *Service) Path() string {
|
||||
return l.licensePath
|
||||
}
|
||||
|
||||
func (l Service) AppURL() string {
|
||||
func (l *Service) AppURL() string {
|
||||
return l.appURL
|
||||
}
|
||||
|
||||
func (l *Service) ContentDeliveryPrefix() string {
|
||||
return l.license.ContentDeliveryPrefix()
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/registry"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/signature"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/sources"
|
||||
"github.com/grafana/grafana/pkg/plugins/pluginassets"
|
||||
"github.com/grafana/grafana/pkg/plugins/pluginscdn"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pipeline"
|
||||
@@ -1572,7 +1573,7 @@ type loaderDepOpts struct {
|
||||
func newLoader(t *testing.T, cfg *config.PluginManagementCfg, reg registry.Service, proc process.Manager,
|
||||
backendFactory plugins.BackendFactoryProvider, errTracker pluginerrs.ErrorTracker,
|
||||
) *Loader {
|
||||
assets := assetpath.ProvideService(cfg, pluginscdn.ProvideService(cfg))
|
||||
assets := assetpath.ProvideService(cfg, pluginscdn.ProvideService(cfg), pluginassets.ProvideService())
|
||||
angularInspector := angularinspector.NewStaticInspector()
|
||||
|
||||
terminate, err := pipeline.ProvideTerminationStage(cfg, reg, proc)
|
||||
@@ -1586,7 +1587,7 @@ func newLoader(t *testing.T, cfg *config.PluginManagementCfg, reg registry.Servi
|
||||
}
|
||||
|
||||
func newLoaderWithOpts(t *testing.T, cfg *config.PluginManagementCfg, opts loaderDepOpts) *Loader {
|
||||
assets := assetpath.ProvideService(cfg, pluginscdn.ProvideService(cfg))
|
||||
assets := assetpath.ProvideService(cfg, pluginscdn.ProvideService(cfg), pluginassets.ProvideService())
|
||||
reg := fakes.NewFakePluginRegistry()
|
||||
proc := fakes.NewFakeProcessManager()
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ func ProvidePluginManagementConfig(cfg *setting.Cfg, settingProvider setting.Pro
|
||||
PluginsCDNSyncLoaderEnabled: features.IsEnabledGlobally(featuremgmt.FlagPluginsCDNSyncLoader),
|
||||
LocalizationForPlugins: features.IsEnabledGlobally(featuremgmt.FlagLocalizationForPlugins),
|
||||
TempoAlertingEnabled: features.IsEnabledGlobally(featuremgmt.FlagTempoAlerting),
|
||||
PluginAssetProvider: features.IsEnabledGlobally(featuremgmt.FlagPluginAssetProvider),
|
||||
},
|
||||
cfg.GrafanaComAPIURL,
|
||||
cfg.DisablePlugins,
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/registry"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/signature"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/sources"
|
||||
pluginassets2 "github.com/grafana/grafana/pkg/plugins/pluginassets"
|
||||
"github.com/grafana/grafana/pkg/plugins/pluginscdn"
|
||||
"github.com/grafana/grafana/pkg/plugins/repo"
|
||||
"github.com/grafana/grafana/pkg/services/caching"
|
||||
@@ -154,6 +155,8 @@ var WireExtensionSet = wire.NewSet(
|
||||
wire.Bind(new(sources.Registry), new(*sources.Service)),
|
||||
checkregistry.ProvideService,
|
||||
wire.Bind(new(checkregistry.CheckService), new(*checkregistry.Service)),
|
||||
pluginassets2.ProvideService,
|
||||
wire.Bind(new(pluginassets2.Provider), new(*pluginassets2.LocalProvider)),
|
||||
)
|
||||
|
||||
func ProvideClientWithMiddlewares(
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/signature"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/signature/statickey"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/sources"
|
||||
"github.com/grafana/grafana/pkg/plugins/pluginassets"
|
||||
"github.com/grafana/grafana/pkg/plugins/pluginscdn"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pipeline"
|
||||
@@ -51,7 +52,7 @@ func CreateIntegrationTestCtx(t *testing.T, cfg *setting.Cfg, coreRegistry *core
|
||||
proc := process.ProvideService()
|
||||
|
||||
disc := pipeline.ProvideDiscoveryStage(pCfg, reg)
|
||||
boot := pipeline.ProvideBootstrapStage(pCfg, signature.ProvideService(pCfg, statickey.New()), assetpath.ProvideService(pCfg, cdn))
|
||||
boot := pipeline.ProvideBootstrapStage(pCfg, signature.ProvideService(pCfg, statickey.New()), assetpath.ProvideService(pCfg, cdn, pluginassets.ProvideService()))
|
||||
valid := pipeline.ProvideValidationStage(pCfg, signature.NewValidator(signature.NewUnsignedAuthorizer(pCfg)), angularInspector)
|
||||
init := pipeline.ProvideInitializationStage(pCfg, reg, provider.ProvideService(coreRegistry), proc, &fakes.FakeAuthService{}, fakes.NewFakeRoleRegistry(), fakes.NewFakeActionSetRegistry(), nil, tracing.InitializeTracerForTest())
|
||||
term, err := pipeline.ProvideTerminationStage(pCfg, reg, proc)
|
||||
@@ -89,7 +90,7 @@ func CreateTestLoader(t *testing.T, cfg *pluginsCfg.PluginManagementCfg, opts Lo
|
||||
}
|
||||
|
||||
if opts.Bootstrapper == nil {
|
||||
opts.Bootstrapper = pipeline.ProvideBootstrapStage(cfg, signature.ProvideService(cfg, statickey.New()), assetpath.ProvideService(cfg, pluginscdn.ProvideService(cfg)))
|
||||
opts.Bootstrapper = pipeline.ProvideBootstrapStage(cfg, signature.ProvideService(cfg, statickey.New()), assetpath.ProvideService(cfg, pluginscdn.ProvideService(cfg), pluginassets.ProvideService()))
|
||||
}
|
||||
|
||||
if opts.Validator == nil {
|
||||
|
||||
Reference in New Issue
Block a user