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