diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-08-01 20:28:45 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-08-01 20:28:45 -0700 |
commit | cf03e0e33859b213f1d7e55b300a074eea107100 (patch) | |
tree | 3b88987c42c75b946c4e4b8eeb71fa2359bfe79d /config | |
parent | 17054b396eff571f49812074024cb9db2e098bdc (diff) |
Create database package (refactoring)
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 != "" { |