diff options
author | Frédéric Guillot <fred@miniflux.net> | 2017-11-21 20:20:20 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2017-11-21 20:20:20 -0800 |
commit | 9ff3c4504cc06291aad5a055ba5db35c6d1fb9e0 (patch) | |
tree | e59f7de5ed2cdaa9eda9ae0911796ff3a159f536 /config | |
parent | 6690f6a70eb319c1156f8a1bb7465e048567580a (diff) |
Set all default config values in config package
Diffstat (limited to 'config')
-rw-r--r-- | config/config.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/config/config.go b/config/config.go index fb462f8..2eaa31c 100644 --- a/config/config.go +++ b/config/config.go @@ -9,13 +9,21 @@ import ( "strconv" ) +// Default config parameters values const ( - DefaultBaseURL = "http://localhost" + DefaultBaseURL = "http://localhost" + DefaultDatabaseURL = "postgres://postgres:postgres@localhost/miniflux2?sslmode=disable" + DefaultWorkerPoolSize = 5 + DefaultPollingFrequency = 60 + DefaultBatchSize = 10 + DefaultDatabaseMaxConns = 20 + DefaultListenAddr = "127.0.0.1:8080" ) -type Config struct { -} +// Config manages configuration parameters. +type Config struct{} +// Get returns a config parameter value. func (c *Config) Get(key, fallback string) string { value := os.Getenv(key) if value == "" { @@ -25,6 +33,7 @@ func (c *Config) Get(key, fallback string) string { return value } +// GetInt returns a config parameter as integer. func (c *Config) GetInt(key string, fallback int) int { value := os.Getenv(key) if value == "" { @@ -35,6 +44,7 @@ func (c *Config) GetInt(key string, fallback int) int { return v } +// NewConfig returns a new Config. func NewConfig() *Config { return &Config{} } |