* Introduce TSDB service Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Erik Sundell <erik.sundell87@gmail.com> Co-authored-by: Will Browne <will.browne@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Will Browne <wbrowne@users.noreply.github.com> Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
40 lines
725 B
Go
40 lines
725 B
Go
package manager
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
)
|
|
|
|
type pluginSettings map[string]string
|
|
|
|
func (ps pluginSettings) ToEnv(prefix string, hostEnv []string) []string {
|
|
env := []string{}
|
|
for k, v := range ps {
|
|
env = append(env, fmt.Sprintf("%s_%s=%s", prefix, strings.ToUpper(k), v))
|
|
}
|
|
|
|
env = append(env, hostEnv...)
|
|
|
|
return env
|
|
}
|
|
|
|
func extractPluginSettings(cfg *setting.Cfg) map[string]pluginSettings {
|
|
psMap := map[string]pluginSettings{}
|
|
for pluginID, settings := range cfg.PluginSettings {
|
|
ps := pluginSettings{}
|
|
for k, v := range settings {
|
|
if k == "path" || strings.ToLower(k) == "id" {
|
|
continue
|
|
}
|
|
|
|
ps[k] = v
|
|
}
|
|
|
|
psMap[pluginID] = ps
|
|
}
|
|
|
|
return psMap
|
|
}
|