diff --git a/util/config.go b/util/config.go index 80d9acae..ee18f930 100644 --- a/util/config.go +++ b/util/config.go @@ -197,10 +197,17 @@ func (conf *configType) Scan() { } conf.TmpPath = path.Clean(conf.TmpPath) - var alertanswer string + fmt.Print(" > Web root URL (default http://localhost:8010/): ") + fmt.Scanln(&conf.WebHost) + + if len(conf.WebHost) == 0 { + conf.WebHost = "http://localhost:8010/" + } + + var EmailAlertAnswer string fmt.Print(" > Enable email alerts (y/n, default n): ") - fmt.Scanln(&alertanswer) - if alertanswer == "yes" || alertanswer == "y" { + fmt.Scanln(&EmailAlertAnswer) + if EmailAlertAnswer == "yes" || EmailAlertAnswer == "y" { conf.EmailAlert = true @@ -225,15 +232,33 @@ func (conf *configType) Scan() { conf.EmailSender = "semaphore@localhost" } - fmt.Print(" > Web root URL (default http://localhost:8010/): ") - fmt.Scanln(&conf.WebHost) - - if len(conf.WebHost) == 0 { - conf.WebHost = "http://localhost:8010/" - } - } else { conf.EmailAlert = false } + var TelegramAlertAnswer string + fmt.Print(" > Enable telegram alerts (y/n, default n): ") + fmt.Scanln(&TelegramAlertAnswer) + if TelegramAlertAnswer == "yes" || TelegramAlertAnswer == "y" { + + conf.TelegramAlert = true + + fmt.Print(" > Telegram bot token (you can get it from @BotFather) (default ''): ") + fmt.Scanln(&conf.TelegramToken) + + if len(conf.TelegramToken) == 0 { + conf.TelegramToken = "" + } + + fmt.Print(" > Telegram chat ID (default ''): ") + fmt.Scanln(&conf.TelegramChat) + + if len(conf.TelegramChat) == 0 { + conf.TelegramChat = "" + } + + } else { + conf.TelegramAlert = false + } + }