Chore: Use externally built core plugins (#76682)
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana/pkg/plugins/config"
|
||||
"github.com/grafana/grafana/pkg/plugins/pluginscdn"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
)
|
||||
|
||||
// Service provides methods for constructing asset paths for plugins.
|
||||
@@ -57,8 +58,14 @@ func (s *Service) Base(n PluginInfo) (string, error) {
|
||||
// Module returns the module.js path for the specified plugin.
|
||||
func (s *Service) Module(n PluginInfo) (string, error) {
|
||||
if n.class == plugins.ClassCore {
|
||||
baseDir := getBaseDir(n.dir)
|
||||
return path.Join("core:plugin", baseDir), nil
|
||||
if s.cfg.Features != nil &&
|
||||
s.cfg.Features.IsEnabled(featuremgmt.FlagExternalCorePlugins) &&
|
||||
filepath.Base(n.dir) == "dist" {
|
||||
// The core plugin has been built externally, use the module from the dist folder
|
||||
} else {
|
||||
baseDir := getBaseDir(n.dir)
|
||||
return path.Join("core:plugin", baseDir), nil
|
||||
}
|
||||
}
|
||||
if s.cdn.PluginSupported(n.pluginJSON.ID) {
|
||||
return s.cdn.AssetURL(n.pluginJSON.ID, n.pluginJSON.Info.Version, "module.js")
|
||||
|
||||
Reference in New Issue
Block a user