From 9ff3c4504cc06291aad5a055ba5db35c6d1fb9e0 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Tue, 21 Nov 2017 20:20:20 -0800 Subject: Set all default config values in config package --- config/config.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'config') 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{} } -- cgit v1.2.3