From 839857807e347e40787ebdc64fbeb8b5ee92b698 Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 4 Nov 2023 22:54:42 +0100 Subject: [PATCH] updated config --- modules/config/config.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/config/config.go b/modules/config/config.go index cf9acbc..52b6680 100644 --- a/modules/config/config.go +++ b/modules/config/config.go @@ -41,11 +41,9 @@ func LoadConfig() { fmt.Println("Load env from system") } - Cfg = Config{ + config := Config{ Debug: os.Getenv("DEBUG") == "true", ColorizedOutput: os.Getenv("COLORIZED_OUTPUT") == "true", - Host: os.Getenv("HOST"), - Port: os.Getenv("PORT"), LogManagerServerUrl: os.Getenv("LOG_MANAGER_SERVER_URL"), Telegram: Telegram{ Debug: os.Getenv("TELEGRAM_DEBUG") == "true", @@ -59,4 +57,15 @@ func LoadConfig() { DatabaseName: os.Getenv("MARIADB_DATABASE_NAME"), }, } + + // load default values if not in docker + if os.Getenv("DOCKER") == "" { + config.Host = os.Getenv("HOST") + config.Port = os.Getenv("PORT") + } else { // load from docker env + config.Host = "0.0.0.0" + config.Port = "3000" + } + + Cfg = config }