forked from NinjasCL/airnotifier-moodle-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
33 lines (29 loc) · 1.11 KB
/
config.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
// Secret config User and Key to send notifications
const config = {
// Configure these headers the same as in AirNotifier Moodle Settings
headers: {
// X-An-App-Name header set in the Moodle Plugin Settings.
name: "X-An-App-Name",
// X-An-App-Key header set in the Moodle Plugin Settings.
// Is recommended to generate a secure random key like an uuidv4
// execute: npm run uuid
// to get a random unique id.
key: "X-An-App-Key",
},
port: 3000, // port to listen. default is 3000 for node servers
listen: "0.0.0.0", // restrict access to this ip range. 0.0.0.0 means all ips allowed
whitelist: [], // leave empty to allow all ips.
};
// Server Config
// See https://github.com/fastify/fastify/tree/master/docs
// for more config options
const server = require("fastify")({
logger: {
level: "debug",
},
// IgnoreTrailingSlash is needed to support calls from the moodle airnotifier plugin
ignoreTrailingSlash: true,
});
// moodle airnotifier plugin send requests as application/x-www-form-urlencoded
server.register(require("fastify-formbody"));
module.exports = {server, config};