diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/config.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/config/config.go b/config/config.go index 4cba789..580f01d 100644 --- a/config/config.go +++ b/config/config.go @@ -20,6 +20,7 @@ const ( defaultPollingFrequency = 60 defaultBatchSize = 10 defaultDatabaseMaxConns = 20 + defaultDatabaseMinConns = 1 defaultListenAddr = "127.0.0.1:8080" defaultCertFile = "" defaultKeyFile = "" @@ -119,11 +120,16 @@ func (c *Config) DatabaseURL() string { return value } -// DatabaseMaxConnections returns the number of maximum database connections. -func (c *Config) DatabaseMaxConnections() int { +// DatabaseMaxConns returns the maximum number of database connections. +func (c *Config) DatabaseMaxConns() int { return c.getInt("DATABASE_MAX_CONNS", defaultDatabaseMaxConns) } +// DatabaseMinConns returns the minimum number of database connections. +func (c *Config) DatabaseMinConns() int { + return c.getInt("DATABASE_MIN_CONNS", defaultDatabaseMinConns) +} + // ListenAddr returns the listen address for the HTTP server. func (c *Config) ListenAddr() string { if port := os.Getenv("PORT"); port != "" { |