SQLStore: customise the limit of retrieved datasources per organisation (#29358)
* SQLStore: customise the limit of retrieved datasources per organisation * update all suggestions regarding nil or 0 as default * Apply suggestions from code review Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com> * correct default.ini description + adding unittest * Apply suggestions from code review Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com> * modify unittest name Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com> Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
This commit is contained in:
co-authored by
Emil Tullstedt
Sofia Papagiannaki
parent
ac922f4e1d
commit
375e8e4fd0
@@ -314,6 +314,9 @@ type Cfg struct {
|
||||
// Sentry config
|
||||
Sentry Sentry
|
||||
|
||||
// Data sources
|
||||
DataSourceLimit int
|
||||
|
||||
// Snapshots
|
||||
SnapshotPublicMode bool
|
||||
|
||||
@@ -826,6 +829,8 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
|
||||
return err
|
||||
}
|
||||
|
||||
cfg.readDataSourcesSettings()
|
||||
|
||||
if VerifyEmailEnabled && !cfg.Smtp.Enabled {
|
||||
log.Warnf("require_email_validation is enabled but smtp is disabled")
|
||||
}
|
||||
@@ -1255,3 +1260,8 @@ func readServerSettings(iniFile *ini.File, cfg *Cfg) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cfg *Cfg) readDataSourcesSettings() {
|
||||
datasources := cfg.Raw.Section("datasources")
|
||||
cfg.DataSourceLimit = datasources.Key("datasource_limit").MustInt(5000)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user