From deb6631625b5cfe5cd3273f2b88c978c4478608a Mon Sep 17 00:00:00 2001 From: Peter Sanchez Date: Tue, 27 Sep 2022 17:58:34 -0600 Subject: [PATCH] Adding Environment config variable --- config/config.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/config.go b/config/config.go index 8089510..08ea7d9 100644 --- a/config/config.go +++ b/config/config.go @@ -27,6 +27,7 @@ type Config struct { EmailAdminErrors bool DefaultFromEmail string DefaultLang string + Environment string Scheme string Domain string @@ -58,6 +59,7 @@ func LoadConfig(fname string) (*Config, error) { EmailAdminErrors: true, DefaultFromEmail: "gobwebs@localhost", DefaultLang: "en", + Environment: "development", Scheme: "http", Domain: "127.0.0.1:8000", } @@ -133,6 +135,10 @@ func LoadConfig(fname string) (*Config, error) { conf.Domain = val } + if val, ok := file.Get("gobwebs", "environment"); ok { + conf.Environment = val + } + conf.DbConnString, ok = file.Get("database", "connection-string") if !ok { return nil, fmt.Errorf("database:connection-string unset") -- 2.45.2