[notifier] 支持配置发信时间
This commit is contained in:
parent
744f2cd783
commit
6dffa66ea9
|
|
@ -37,10 +37,11 @@ storage:
|
||||||
dubious_process_list_file: "dubious_processes.data"
|
dubious_process_list_file: "dubious_processes.data"
|
||||||
|
|
||||||
notification:
|
notification:
|
||||||
|
interval: 5 # minutes
|
||||||
email:
|
email:
|
||||||
enabled: true
|
enabled: true
|
||||||
recipients:
|
recipients:
|
||||||
- admin@wuko.top
|
-
|
||||||
smtp:
|
smtp:
|
||||||
server:
|
server:
|
||||||
port: 465
|
port: 465
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@ type Config struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type NotificationConfig struct {
|
type NotificationConfig struct {
|
||||||
Email EmailConfig `yaml:"email"`
|
Email EmailConfig `yaml:"email"`
|
||||||
|
Interval int `yaml:"interval"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type EmailConfig struct {
|
type EmailConfig struct {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ func NewAlerter(cfg config.NotificationConfig) *Alerter {
|
||||||
mailer: mail.NewMailer(cfg.Email),
|
mailer: mail.NewMailer(cfg.Email),
|
||||||
eventChan: make(chan AlertEvent, 100),
|
eventChan: make(chan AlertEvent, 100),
|
||||||
buffer: make([]AlertEvent, 0),
|
buffer: make([]AlertEvent, 0),
|
||||||
interval: 30 * time.Second, // Todo: 可配置化
|
interval: time.Duration(cfg.Interval) * time.Minute,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user