+NotifyBuiltinEnable

This commit is contained in:
Ulric Qin 2022-03-01 16:27:21 +08:00
parent 085bd39684
commit c6356df81f
3 changed files with 12 additions and 5 deletions

View File

@ -66,6 +66,8 @@ Batch = 5
[Alerting] [Alerting]
TemplatesDir = "./etc/template" TemplatesDir = "./etc/template"
NotifyConcurrency = 10 NotifyConcurrency = 10
# use builtin go code notify by default
NotifyBuiltinEnable = true
[Alerting.CallScript] [Alerting.CallScript]
# built in sending capability in go code # built in sending capability in go code

View File

@ -135,11 +135,12 @@ type SMTPConfig struct {
} }
type Alerting struct { type Alerting struct {
TemplatesDir string TemplatesDir string
NotifyConcurrency int NotifyConcurrency int
CallScript CallScript NotifyBuiltinEnable bool
RedisPub RedisPub CallScript CallScript
Webhook Webhook RedisPub RedisPub
Webhook Webhook
} }
type CallScript struct { type CallScript struct {

View File

@ -119,6 +119,10 @@ func alertingRedisPub(bs []byte) {
func handleNotice(notice Notice, bs []byte) { func handleNotice(notice Notice, bs []byte) {
alertingCallScript(bs) alertingCallScript(bs)
if !config.C.Alerting.NotifyBuiltinEnable {
return
}
emailset := make(map[string]struct{}) emailset := make(map[string]struct{})
phoneset := make(map[string]struct{}) phoneset := make(map[string]struct{})
wecomset := make(map[string]struct{}) wecomset := make(map[string]struct{})