forked from sentinl/sentinl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.js
29 lines (24 loc) · 994 Bytes
/
init.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
import later from 'later';
import _ from 'lodash';
import mustache from 'mustache';
import masterRoute from './server/routes/routes';
import scheduler from './server/lib/scheduler';
import helpers from './server/lib/helpers';
import $window from 'jquery';
module.exports = function (server, options) {
var debug = false;
var config = require('./server/lib/config');
var $ = require('jquery');
server.log(['status', 'info', 'KaaE'], 'KaaE Initializing');
server.kaaeStore = [];
masterRoute(server);
// Create KaaE Indices, if required
helpers.createKaaeIndex(server,config);
helpers.createKaaeAlarmIndex(server,config);
/* Bird Watching and Duck Hunting */
var client = server.plugins.elasticsearch.client;
var sched = later.parse.text('every 1 minute');
var t = later.setInterval(function(){ scheduler.doalert(server,client) }, sched);
/* run NOW, plus later */
scheduler.doalert(server,client);
};