The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/services/pluginsintegration/plugininstaller/checker.go

36 lines
732 B

package plugininstaller
import "github.com/grafana/grafana/pkg/setting"
type Preinstall interface {
IsPreinstalled(pluginID string) bool
IsPinned(pluginID string) bool
}
func ProvidePreinstall(
cfg *setting.Cfg,
) *PreinstallImpl {
plugins := make(map[string]*setting.InstallPlugin)
for _, p := range cfg.PreinstallPlugins {
plugins[p.ID] = &p
}
return &PreinstallImpl{
plugins: plugins,
}
}
type PreinstallImpl struct {
plugins map[string]*setting.InstallPlugin
}
func (c *PreinstallImpl) IsPreinstalled(pluginID string) bool {
_, ok := c.plugins[pluginID]
return ok
}
func (c *PreinstallImpl) IsPinned(pluginID string) bool {
if p, ok := c.plugins[pluginID]; ok {
return p.Version != ""
}
return false
}