2022-09-14 08:35:35 -05:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/grafana/grafana-azure-sdk-go/azsettings"
|
|
|
|
|
2023-04-18 09:12:05 -05:00
|
|
|
"github.com/grafana/grafana/pkg/plugins"
|
2023-02-28 09:10:27 -06:00
|
|
|
"github.com/grafana/grafana/pkg/plugins/log"
|
2022-09-14 08:35:35 -05:00
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Cfg struct {
|
|
|
|
log log.Logger
|
|
|
|
|
|
|
|
DevMode bool
|
|
|
|
|
2022-09-23 07:27:01 -05:00
|
|
|
PluginsPath string
|
|
|
|
|
2022-09-14 08:35:35 -05:00
|
|
|
PluginSettings setting.PluginSettings
|
|
|
|
PluginsAllowUnsigned []string
|
2023-09-14 05:58:12 -05:00
|
|
|
DisablePlugins []string
|
2022-09-14 08:35:35 -05:00
|
|
|
|
|
|
|
// AWS Plugin Auth
|
|
|
|
AWSAllowedAuthProviders []string
|
|
|
|
AWSAssumeRoleEnabled bool
|
2023-08-04 15:06:01 -05:00
|
|
|
AWSExternalId string
|
2022-09-14 08:35:35 -05:00
|
|
|
|
|
|
|
// Azure Cloud settings
|
|
|
|
Azure *azsettings.AzureSettings
|
|
|
|
|
2023-04-07 09:20:25 -05:00
|
|
|
// Proxy Settings
|
|
|
|
ProxySettings setting.SecureSocksDSProxySettings
|
|
|
|
|
2022-09-14 08:35:35 -05:00
|
|
|
BuildVersion string // TODO Remove
|
2022-11-02 08:51:51 -05:00
|
|
|
|
|
|
|
LogDatasourceRequests bool
|
2023-01-27 08:08:17 -06:00
|
|
|
|
|
|
|
PluginsCDNURLTemplate string
|
2023-03-30 16:31:14 -05:00
|
|
|
|
2023-04-05 07:40:08 -05:00
|
|
|
Tracing Tracing
|
2023-04-18 09:12:05 -05:00
|
|
|
|
|
|
|
GrafanaComURL string
|
|
|
|
|
2023-08-31 08:45:44 -05:00
|
|
|
GrafanaAppURL string
|
|
|
|
GrafanaAppSubURL string
|
2023-06-26 09:38:43 -05:00
|
|
|
|
2023-04-18 09:12:05 -05:00
|
|
|
Features plugins.FeatureToggles
|
2023-06-07 04:08:01 -05:00
|
|
|
|
|
|
|
AngularSupportEnabled bool
|
2022-09-14 08:35:35 -05:00
|
|
|
}
|
|
|
|
|
2023-04-05 07:40:08 -05:00
|
|
|
func NewCfg(devMode bool, pluginsPath string, pluginSettings setting.PluginSettings, pluginsAllowUnsigned []string,
|
2023-08-04 15:06:01 -05:00
|
|
|
awsAllowedAuthProviders []string, awsAssumeRoleEnabled bool, awsExternalId string, azure *azsettings.AzureSettings, secureSocksDSProxy setting.SecureSocksDSProxySettings,
|
2023-08-31 08:45:44 -05:00
|
|
|
grafanaVersion string, logDatasourceRequests bool, pluginsCDNURLTemplate string, appURL string, appSubURL string, tracing Tracing, features plugins.FeatureToggles, angularSupportEnabled bool,
|
2023-09-14 05:58:12 -05:00
|
|
|
grafanaComURL string, disablePlugins []string) *Cfg {
|
2022-09-14 08:35:35 -05:00
|
|
|
return &Cfg{
|
2023-04-05 07:40:08 -05:00
|
|
|
log: log.New("plugin.cfg"),
|
|
|
|
PluginsPath: pluginsPath,
|
|
|
|
BuildVersion: grafanaVersion,
|
|
|
|
DevMode: devMode,
|
|
|
|
PluginSettings: pluginSettings,
|
|
|
|
PluginsAllowUnsigned: pluginsAllowUnsigned,
|
2023-09-14 05:58:12 -05:00
|
|
|
DisablePlugins: disablePlugins,
|
2023-04-05 07:40:08 -05:00
|
|
|
AWSAllowedAuthProviders: awsAllowedAuthProviders,
|
|
|
|
AWSAssumeRoleEnabled: awsAssumeRoleEnabled,
|
2023-08-04 15:06:01 -05:00
|
|
|
AWSExternalId: awsExternalId,
|
2023-04-05 07:40:08 -05:00
|
|
|
Azure: azure,
|
2023-04-07 09:20:25 -05:00
|
|
|
ProxySettings: secureSocksDSProxy,
|
2023-04-05 07:40:08 -05:00
|
|
|
LogDatasourceRequests: logDatasourceRequests,
|
|
|
|
PluginsCDNURLTemplate: pluginsCDNURLTemplate,
|
|
|
|
Tracing: tracing,
|
Plugins: Angular detector: Remote patterns fetching (#69843)
* Plugins: Angular detector: Remote patterns fetching
* Renamed PatternType to GCOMPatternType
* Renamed files
* Renamed more files
* Moved files again
* Add type checks, unexport GCOM structs
* Cache failures, update log messages, fix GCOM URL
* Fail silently for unknown pattern types, update docstrings
* Fix tests
* Rename gcomPattern.Value to gcomPattern.Pattern
* Refactoring
* Add FlagPluginsRemoteAngularDetectionPatterns feature flag
* Fix tests
* Re-generate feature flags
* Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector
* Add TestProvideInspector
* Add TestContainsBytesDetector and TestRegexDetector
* Renamed getter to provider
* More tests
* TestStaticDetectorsProvider, TestSequenceDetectorsProvider
* GCOM tests
* Lint
* Made detector.detect unexported, updated docstrings
* Allow changing grafana.com URL
* Fix API path, add more logs
* Update tryUpdateRemoteDetectors docstring
* Use angulardetector http client
* Return false, nil if module.js does not exist
* Chore: Split angualrdetector into angularinspector and angulardetector packages
Moved files around, changed references and fixed tests:
- Split the old angulardetector package into angular/angulardetector and angular/angularinspector
- angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...)
- angularinspector provides the actual angular detection service used directly in pluginsintegration
- Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector
* Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go
Forgot to rename those two files to match the package's names
* Renamed angularinspector.ProvideInspector to angularinspector.ProvideService
* Renamed "harcoded" to "static" and "remote" to "dynamic"
from PR review, matches the same naming schema used for signing keys fetching
* Fix merge conflict on updated angular patterns
* Removed GCOM cache
* Renamed Detect to DetectAngular and Detector to AngularDetector
* Fix call to NewGCOMDetectorsProvider in newDynamicInspector
* Removed unused test function newError500GCOMScenario
* Added angularinspector service definition in pluginsintegration
* Moved dynamic inspector into pluginsintegration
* Move gcom angulardetectorsprovider into pluginsintegration
* Log errUnknownPatternType at debug level
* re-generate feature flags
* fix error log
2023-06-26 08:33:21 -05:00
|
|
|
GrafanaComURL: grafanaComURL,
|
2023-06-26 09:38:43 -05:00
|
|
|
GrafanaAppURL: appURL,
|
2023-08-31 08:45:44 -05:00
|
|
|
GrafanaAppSubURL: appSubURL,
|
2023-04-18 09:12:05 -05:00
|
|
|
Features: features,
|
2023-06-07 04:08:01 -05:00
|
|
|
AngularSupportEnabled: angularSupportEnabled,
|
2022-09-14 08:35:35 -05:00
|
|
|
}
|
|
|
|
}
|