grafana/pkg/plugins/config.go
Will Browne 7694fff0ef
[WIP] Plugins: Refactoring backend initialization flow (#42247)
* refactoring store interface and init flow

* fix import

* fix linter

* refactor resource calling

* load with class

* re-order args

* fix tests

* fix linter

* remove old creator

* add custom config struct

* fix some tests

* cleanup

* fix linter

* add connect failure error

* remove unused err

* convert test over
2022-01-14 13:30:39 +01:00

58 lines
1.1 KiB
Go

package plugins
import (
"github.com/grafana/grafana/pkg/setting"
)
type Cfg struct {
DevMode bool
PluginsPath string
PluginSettings setting.PluginSettings
PluginsAllowUnsigned []string
EnterpriseLicensePath string
// AWS Plugin Auth
AWSAllowedAuthProviders []string
AWSAssumeRoleEnabled bool
// Azure Cloud settings
Azure setting.AzureSettings
CheckForUpdates bool
BuildVersion string // TODO Remove
AppSubURL string // TODO Remove
}
func NewCfg() *Cfg {
return &Cfg{}
}
func FromGrafanaCfg(grafanaCfg *setting.Cfg) *Cfg {
cfg := &Cfg{}
cfg.DevMode = grafanaCfg.Env == setting.Dev
cfg.PluginsPath = grafanaCfg.PluginsPath
cfg.PluginSettings = grafanaCfg.PluginSettings
cfg.PluginsAllowUnsigned = grafanaCfg.PluginsAllowUnsigned
cfg.EnterpriseLicensePath = grafanaCfg.EnterpriseLicensePath
// AWS
cfg.AWSAllowedAuthProviders = grafanaCfg.AWSAllowedAuthProviders
cfg.AWSAssumeRoleEnabled = grafanaCfg.AWSAssumeRoleEnabled
// Azure
cfg.Azure = grafanaCfg.Azure
cfg.CheckForUpdates = grafanaCfg.CheckForUpdates
cfg.BuildVersion = grafanaCfg.BuildVersion
cfg.AppSubURL = grafanaCfg.AppSubURL
return cfg
}