1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

Create database package (refactoring)

This commit is contained in:
Frédéric Guillot 2018-08-01 20:28:45 -07:00
parent 17054b396e
commit cf03e0e338
30 changed files with 61 additions and 54 deletions

View file

@ -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 != "" {