mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 15:29:28 +01:00
add config generation for telegram alerting
This commit is contained in:
parent
90d7708647
commit
d95491d05d
@ -197,10 +197,17 @@ func (conf *configType) Scan() {
|
|||||||
}
|
}
|
||||||
conf.TmpPath = path.Clean(conf.TmpPath)
|
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.Print(" > Enable email alerts (y/n, default n): ")
|
||||||
fmt.Scanln(&alertanswer)
|
fmt.Scanln(&EmailAlertAnswer)
|
||||||
if alertanswer == "yes" || alertanswer == "y" {
|
if EmailAlertAnswer == "yes" || EmailAlertAnswer == "y" {
|
||||||
|
|
||||||
conf.EmailAlert = true
|
conf.EmailAlert = true
|
||||||
|
|
||||||
@ -225,15 +232,33 @@ func (conf *configType) Scan() {
|
|||||||
conf.EmailSender = "semaphore@localhost"
|
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 {
|
} else {
|
||||||
conf.EmailAlert = false
|
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
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user