-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.js
executable file
·32 lines (28 loc) · 868 Bytes
/
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
var Slackus = require('./lib/slackus.js'),
config = require('./config.js');
// Check if the required configuration values have been set.
var required = [
'slack.webhook',
'disqus.forums',
'disqus.authentication.api_secret',
'disqus.authentication.api_key',
'disqus.authentication.access_token'
].filter(function(config, path) {
var i, len;
for (i = 0, path = path.split('.'), len = path.length; i < len; i++) {
config = config[path[i]];
}
return !config;
}.bind(this, config));
// Exit if missing required configuration.
if (required.length) {
console.log('Missing required configuration:');
console.log(required.join(', '));
process.exit(1);
}
// Fallback to defaults.
config.disqus.limit = config.disqus.limit || 25;
config.interval = config.interval || 60;
// Start checking!
var slackus = new Slackus(config);
slackus.start();