mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 22:12:08 +08:00
Backend Plugins: Plugin configuration using Grafana config (#23451)
Enables adding a section `plugin.<plugin id>` and key/value to Grafana configuration file which will be converted and sent as environment variables to the backend plugin. Also sends some additional environment variables, Grafana version (GF_VERSION), Grafana edition (GF_EDITION) and enterprise license path (GF_ENTERPRISE_LICENSE_PATH). Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> Fixes #21515,
This commit is contained in:

committed by
GitHub

parent
941cd59894
commit
34266cd369
@ -153,19 +153,14 @@ func (pm *PluginManager) Run(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (pm *PluginManager) checkPluginPaths() error {
|
||||
for _, section := range setting.Raw.Sections() {
|
||||
if !strings.HasPrefix(section.Name(), "plugin.") {
|
||||
continue
|
||||
}
|
||||
|
||||
path := section.Key("path").String()
|
||||
if path == "" {
|
||||
for pluginID, settings := range pm.Cfg.PluginSettings {
|
||||
path, exists := settings["path"]
|
||||
if !exists || path == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
if err := pm.scan(path); err != nil {
|
||||
return errutil.Wrapf(err, "Failed to scan directory configured for plugin '%s': '%s'",
|
||||
section.Name(), path)
|
||||
return errutil.Wrapf(err, "Failed to scan directory configured for plugin '%s': '%s'", pluginID, path)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user