2022-09-14 21:35:35 +08:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/grafana/grafana-azure-sdk-go/azsettings"
|
|
|
|
|
2023-04-18 22:12:05 +08:00
|
|
|
"github.com/grafana/grafana/pkg/plugins"
|
2023-02-28 23:10:27 +08:00
|
|
|
"github.com/grafana/grafana/pkg/plugins/log"
|
2022-09-14 21:35:35 +08:00
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Cfg struct {
|
|
|
|
log log.Logger
|
|
|
|
|
|
|
|
DevMode bool
|
|
|
|
|
2022-09-23 20:27:01 +08:00
|
|
|
PluginsPath string
|
|
|
|
|
2022-09-14 21:35:35 +08:00
|
|
|
PluginSettings setting.PluginSettings
|
|
|
|
PluginsAllowUnsigned []string
|
|
|
|
|
|
|
|
// AWS Plugin Auth
|
|
|
|
AWSAllowedAuthProviders []string
|
|
|
|
AWSAssumeRoleEnabled bool
|
|
|
|
|
|
|
|
// Azure Cloud settings
|
|
|
|
Azure *azsettings.AzureSettings
|
|
|
|
|
2023-04-07 22:20:25 +08:00
|
|
|
// Proxy Settings
|
|
|
|
ProxySettings setting.SecureSocksDSProxySettings
|
|
|
|
|
2022-09-14 21:35:35 +08:00
|
|
|
BuildVersion string // TODO Remove
|
2022-11-02 21:51:51 +08:00
|
|
|
|
|
|
|
LogDatasourceRequests bool
|
2023-01-27 22:08:17 +08:00
|
|
|
|
|
|
|
PluginsCDNURLTemplate string
|
2023-03-31 05:31:14 +08:00
|
|
|
|
2023-04-05 20:40:08 +08:00
|
|
|
Tracing Tracing
|
2023-04-18 22:12:05 +08:00
|
|
|
|
|
|
|
GrafanaComURL string
|
|
|
|
|
|
|
|
Features plugins.FeatureToggles
|
2022-09-14 21:35:35 +08:00
|
|
|
}
|
|
|
|
|
2023-04-05 20:40:08 +08:00
|
|
|
func NewCfg(devMode bool, pluginsPath string, pluginSettings setting.PluginSettings, pluginsAllowUnsigned []string,
|
2023-04-07 22:20:25 +08:00
|
|
|
awsAllowedAuthProviders []string, awsAssumeRoleEnabled bool, azure *azsettings.AzureSettings, secureSocksDSProxy setting.SecureSocksDSProxySettings,
|
2023-06-07 00:09:41 +08:00
|
|
|
grafanaVersion string, logDatasourceRequests bool, pluginsCDNURLTemplate string, tracing Tracing, features plugins.FeatureToggles) *Cfg {
|
2022-09-14 21:35:35 +08:00
|
|
|
return &Cfg{
|
2023-04-05 20:40:08 +08:00
|
|
|
log: log.New("plugin.cfg"),
|
|
|
|
PluginsPath: pluginsPath,
|
|
|
|
BuildVersion: grafanaVersion,
|
|
|
|
DevMode: devMode,
|
|
|
|
PluginSettings: pluginSettings,
|
|
|
|
PluginsAllowUnsigned: pluginsAllowUnsigned,
|
|
|
|
AWSAllowedAuthProviders: awsAllowedAuthProviders,
|
|
|
|
AWSAssumeRoleEnabled: awsAssumeRoleEnabled,
|
|
|
|
Azure: azure,
|
2023-04-07 22:20:25 +08:00
|
|
|
ProxySettings: secureSocksDSProxy,
|
2023-04-05 20:40:08 +08:00
|
|
|
LogDatasourceRequests: logDatasourceRequests,
|
|
|
|
PluginsCDNURLTemplate: pluginsCDNURLTemplate,
|
|
|
|
Tracing: tracing,
|
2023-04-18 22:12:05 +08:00
|
|
|
GrafanaComURL: "https://grafana.com",
|
|
|
|
Features: features,
|
2022-09-14 21:35:35 +08:00
|
|
|
}
|
|
|
|
}
|