forked from Neverbland/slack-harvest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
45 lines (36 loc) · 1.34 KB
/
app.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
/*jshint node: true*/
'use strict';
/*
* Main application body and dispatch point for
* Slack - Harvest integration miniserver
*
* @author Maciej Garycki <[email protected]>
*/
var
express = require('express'),
app = express(),
config = require('./config/index.js'),
logger = require('./app/services/logger.js')('default', config.logger),
harvest = require('./app/services/harvest')('default', config.harvest),
slack = require('./app/services/slack')('default', config.slack),
notifier = require('./app/services/notifier'),
reportNotifier = require('./app/services/report')(slack, harvest),
slackNotifier = require('./app/services/slack/notifier')(slack, harvest),
slackReminder = require('./app/services/slack/notifier/remind')(slack, harvest),
server
;
harvest.setUsers(config.users);
slack.setUsers(config.users);
// Defining two notification channels
notifier.addNotifier('users', slackNotifier);
notifier.addNotifier('reminder', slackReminder);
notifier.addNotifier('management', reportNotifier);
require('./app/event_listeners')(app);
require('./app/api')(app, config.api);
require('./app/services/cronjobs')(app, config.cron);
module.exports = app;
if (!module.parent) {
server = app.listen(config.app.port, function () {
logger.info('Started web server with config : ', config, {});
});
}