updated config

main
alex 2023-11-04 22:54:30 +01:00
parent 8ce51dcbbd
commit ac42d1989d
1 changed files with 12 additions and 3 deletions

View File

@ -50,11 +50,9 @@ func LoadConfig() {
fmt.Println("Load env from system") fmt.Println("Load env from system")
} }
Cfg = Config{ config := Config{
Debug: os.Getenv("DEBUG") == "true", Debug: os.Getenv("DEBUG") == "true",
ColorizedOutput: os.Getenv("COLORIZED_OUTPUT") == "true", ColorizedOutput: os.Getenv("COLORIZED_OUTPUT") == "true",
Host: os.Getenv("HOST"),
Port: os.Getenv("PORT"),
LogManagerServerUrl: os.Getenv("LOG_MANAGER_SERVER_URL"), LogManagerServerUrl: os.Getenv("LOG_MANAGER_SERVER_URL"),
TelegramBotManagerEnabled: os.Getenv("TELEGRAM_BOT_MANAGER_ENABLED") == "true", TelegramBotManagerEnabled: os.Getenv("TELEGRAM_BOT_MANAGER_ENABLED") == "true",
TelegramBotManagerServerUrl: os.Getenv("TELEGRAM_BOT_MANAGER_SERVER_URL"), TelegramBotManagerServerUrl: os.Getenv("TELEGRAM_BOT_MANAGER_SERVER_URL"),
@ -75,4 +73,15 @@ func LoadConfig() {
Token: os.Getenv("INVEX_API_TOKEN"), Token: os.Getenv("INVEX_API_TOKEN"),
}, },
} }
// 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
} }