|
@@ -27,16 +27,27 @@ func main() {
|
27
|
27
|
ExecEndpoint: cfg.Warp10Exec,
|
28
|
28
|
ReadToken: cfg.ReadToken,
|
29
|
29
|
}
|
30
|
|
- dialer := gomail.NewDialer(
|
31
|
|
- cfg.Mail.SMTP.Host, cfg.Mail.SMTP.Port, cfg.Mail.SMTP.Username,
|
32
|
|
- cfg.Mail.SMTP.Password,
|
33
|
|
- )
|
34
|
30
|
alerter := alert.Alerter{
|
35
|
|
- Dialer: dialer,
|
|
31
|
+ Dialer: nil,
|
36
|
32
|
Sender: cfg.Mail.Sender,
|
37
|
33
|
}
|
38
|
34
|
|
39
|
35
|
for _, script := range cfg.Scripts {
|
|
36
|
+ if script.Action == "email" && alerter.Dialer == nil {
|
|
37
|
+ if cfg.Mail == nil {
|
|
38
|
+ logrus.Errorf(
|
|
39
|
+ "no configuration set for sending emails, ignoring script %s",
|
|
40
|
+ script.Key,
|
|
41
|
+ )
|
|
42
|
+ continue
|
|
43
|
+ }
|
|
44
|
+
|
|
45
|
+ alerter.Dialer = gomail.NewDialer(
|
|
46
|
+ cfg.Mail.SMTP.Host, cfg.Mail.SMTP.Port, cfg.Mail.SMTP.Username,
|
|
47
|
+ cfg.Mail.SMTP.Password,
|
|
48
|
+ )
|
|
49
|
+ }
|
|
50
|
+
|
40
|
51
|
if err := process.Process(client, script, alerter); err != nil {
|
41
|
52
|
logrus.Error(err)
|
42
|
53
|
}
|