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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user