mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 07:12:13 +08:00
[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
This commit is contained in:
57
pkg/plugins/config.go
Normal file
57
pkg/plugins/config.go
Normal file
@ -0,0 +1,57 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user