aboutsummaryrefslogtreecommitdiff
path: root/server_config_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-01-20 22:28:36 +0700
committerShulhan <ms@kilabit.info>2026-01-20 22:28:36 +0700
commitd0969869954c299c04ea58ab0fda1eba6a0350da (patch)
tree8d316903a98e384ffb7746819618521eb66683eb /server_config_test.go
parentbf87c6ad4824c7ed1c990aeff2d2883936c1f20a (diff)
downloadlilin-d0969869954c299c04ea58ab0fda1eba6a0350da.tar.xz
all: support sending notification to SMTP server (email)
In the main configuration, lilin.cfg, user now can add "notif" section with kind "smtp" to send notification using user's email. This require renaming "webhook_url" to "remote_url" to minimize duplicate field, so different kind of notif can use the same "remote_url" value.
Diffstat (limited to 'server_config_test.go')
-rw-r--r--server_config_test.go27
1 files changed, 19 insertions, 8 deletions
diff --git a/server_config_test.go b/server_config_test.go
index bb30e5c..bd17b5e 100644
--- a/server_config_test.go
+++ b/server_config_test.go
@@ -16,15 +16,15 @@ func TestServerConfig_init(t *testing.T) {
exp ServerConfig
}
- var webhookURL12000 *url.URL
- var webhookURL12001 *url.URL
+ var remoteURL12000 *url.URL
+ var remoteURL12001 *url.URL
var err error
- webhookURL12000, err = url.Parse(`http://127.0.0.1:12000`)
+ remoteURL12000, err = url.Parse(`http://127.0.0.1:12000`)
if err != nil {
t.Fatal(err)
}
- webhookURL12001, err = url.Parse(`http://127.0.0.1:12001`)
+ remoteURL12001, err = url.Parse(`http://127.0.0.1:12001`)
if err != nil {
t.Fatal(err)
}
@@ -39,18 +39,29 @@ func TestServerConfig_init(t *testing.T) {
Address: `127.0.0.1:12121`,
Notifs: []*NotifConfig{{
Kind: `mattermost`,
- WebhookURL: `http://127.0.0.1:12000`,
+ RemoteURL: `http://127.0.0.1:12000`,
Channel: `chan_1`,
UpTemplate: `Service {{.ID}} is up again!`,
DownTemplate: `Service {{.ID}} is down: {{.Error}}`,
- webhookURL: webhookURL12000,
+ remoteURL: remoteURL12000,
}, {
Kind: `mattermost`,
- WebhookURL: `http://127.0.0.1:12001`,
+ RemoteURL: `http://127.0.0.1:12001`,
Channel: `chan_2`,
UpTemplate: `Service {{.ID}} is alive!`,
DownTemplate: `Service {{.ID}} is down: {{.Error}}`,
- webhookURL: webhookURL12001,
+ remoteURL: remoteURL12001,
+ }, {
+ Kind: `smtp`,
+ RemoteURL: `smtps://127.0.0.1:4650`,
+ User: `john.doe@example.local`,
+ Password: `dummy`,
+ Recipient: []string{
+ `jane@example.local`,
+ `kent@example.local`,
+ },
+ UpTemplate: `Service {{.ID}} is alive!`,
+ DownTemplate: `Service {{.ID}} is down: {{.Error}}`,
}},
},
}}