@ -380,6 +380,11 @@ type Cfg struct {
ExpressionsEnabled bool
ExpressionsEnabled bool
ImageUploadProvider string
ImageUploadProvider string
// LiveMaxConnections is a maximum number of WebSocket connections to
// Grafana Live ws endpoint (per Grafana server instance). 0 disables
// Live, -1 means unlimited connections.
LiveMaxConnections int
}
}
// IsLiveConfigEnabled returns true if live should be able to save configs to SQL tables
// IsLiveConfigEnabled returns true if live should be able to save configs to SQL tables
@ -950,6 +955,10 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
cfg . readDateFormats ( )
cfg . readDateFormats ( )
cfg . readSentryConfig ( )
cfg . readSentryConfig ( )
if err := cfg . readLiveSettings ( iniFile ) ; err != nil {
return err
}
return nil
return nil
}
}
@ -1420,3 +1429,12 @@ func (cfg *Cfg) readDataSourcesSettings() {
datasources := cfg . Raw . Section ( "datasources" )
datasources := cfg . Raw . Section ( "datasources" )
cfg . DataSourceLimit = datasources . Key ( "datasource_limit" ) . MustInt ( 5000 )
cfg . DataSourceLimit = datasources . Key ( "datasource_limit" ) . MustInt ( 5000 )
}
}
func ( cfg * Cfg ) readLiveSettings ( iniFile * ini . File ) error {
section := iniFile . Section ( "live" )
cfg . LiveMaxConnections = section . Key ( "max_connections" ) . MustInt ( 100 )
if cfg . LiveMaxConnections < - 1 {
return fmt . Errorf ( "unexpected value %d for [live] max_connections" , cfg . LiveMaxConnections )
}
return nil
}