-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
55 lines (51 loc) · 1.52 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const openapi = require('./openApi.json');
const utilities= require('./utilities.js')
module.exports = (app) => {
const plugin = {
id: 'utilities-sk',
name: 'Signalk Plugin Utilities',
start: (settings, restartPlugin) => {
utilities.configure(settings)
plugin.registerWithRouter = function(router) {
router.post('/sendmail', async (req, res) => {
const info= await utilities.sendmail(req.body)
app.debug(info.response)
res.json({message: info.response})
});
};
},
stop: () => {
}
};
plugin.schema = {
type: 'object',
properties:{
node_mailer:{
type: 'object',
title:'Node Mailer Configuration',
required: ['smtp_host', 'smtp_port', 'smtp_user', 'smtp_password'],
properties: {
smtp_host: {
type: 'string',
title: 'SMTP Host for sending email warning (e.g.: smtp.gmail.com)'
},
smtp_port: {
type: 'number',
title: 'SMTP Port (e.g.: 465 for secure, 587 for insecure)',
default: 465
},
smtp_user:{
type: 'string',
title: 'SMTP user ID'
},
smtp_password:{
type:'string',
title: 'SMTP user password'
}
}
}
}
}
plugin.getOpenApi = () => openapi;
return plugin;
};