plugins: add more configuration parameters to the plugin-config (#83060)

* envvars: add more configs

* made row-limit optional

* more consistent naming
This commit is contained in:
Gábor Farkas
2024-02-21 12:32:10 +02:00
committed by GitHub
parent 778d80f922
commit a62dccb0c0
4 changed files with 111 additions and 28 deletions
+14
View File
@@ -100,6 +100,8 @@ func (s *Service) Get(ctx context.Context, p *plugins.Plugin) []string {
}
// GetConfigMap returns a map of configuration that should be passed in a plugin request.
//
//nolint:gocyclo
func (s *Service) GetConfigMap(ctx context.Context, pluginID string, _ *auth.ExternalService) map[string]string {
m := make(map[string]string)
@@ -110,6 +112,18 @@ func (s *Service) GetConfigMap(ctx context.Context, pluginID string, _ *auth.Ext
m[backend.ConcurrentQueryCount] = strconv.Itoa(s.cfg.ConcurrentQueryCount)
}
if s.cfg.UserFacingDefaultError != "" {
m[backend.UserFacingDefaultError] = s.cfg.UserFacingDefaultError
}
if s.cfg.DataProxyRowLimit != 0 {
m[backend.SQLRowLimit] = strconv.FormatInt(s.cfg.DataProxyRowLimit, 10)
}
m[backend.SQLMaxOpenConnsDefault] = strconv.Itoa(s.cfg.SQLDatasourceMaxOpenConnsDefault)
m[backend.SQLMaxIdleConnsDefault] = strconv.Itoa(s.cfg.SQLDatasourceMaxIdleConnsDefault)
m[backend.SQLMaxConnLifetimeSecondsDefault] = strconv.Itoa(s.cfg.SQLDatasourceMaxConnLifetimeDefault)
// TODO add support via plugin SDK
// if externalService != nil {
// m[oauthtokenretriever.AppURL] = s.cfg.GrafanaAppURL