mirror of
https://github.com/grafana/grafana.git
synced 2024-11-28 03:34:15 -06:00
26 lines
524 B
Go
26 lines
524 B
Go
|
package setting
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
|
||
|
"gopkg.in/ini.v1"
|
||
|
)
|
||
|
|
||
|
// PluginSettings maps plugin id to map of key/value settings.
|
||
|
type PluginSettings map[string]map[string]string
|
||
|
|
||
|
func extractPluginSettings(sections []*ini.Section) PluginSettings {
|
||
|
psMap := PluginSettings{}
|
||
|
for _, section := range sections {
|
||
|
sectionName := section.Name()
|
||
|
if !strings.HasPrefix(sectionName, "plugin.") {
|
||
|
continue
|
||
|
}
|
||
|
|
||
|
pluginID := strings.Replace(sectionName, "plugin.", "", 1)
|
||
|
psMap[pluginID] = section.KeysHash()
|
||
|
}
|
||
|
|
||
|
return psMap
|
||
|
}
|