forked from googlearchive/flashlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
30 lines (26 loc) · 891 Bytes
/
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
#!/usr/bin/env node
/*
* @version 0.3, 3 June 2014
*/
var ElasticClient = require('elasticsearchclient'),
conf = require('./config'),
fbutil = require('./lib/fbutil'),
PathMonitor = require('./lib/PathMonitor'),
SearchQueue = require('./lib/SearchQueue');
// connect to ElasticSearch
var esc = new ElasticClient({
host: conf.ES_HOST,
port: conf.ES_PORT,
// pathPrefix: 'optional pathPrefix',
secure: false,
//Optional basic HTTP Auth
auth: conf.ES_USER? {
username: conf.ES_USER,
password: conf.ES_PASS
} : null
});
console.log('Connected to ElasticSearch host %s:%s'.grey, conf.ES_HOST, conf.ES_PORT);
fbutil.auth(conf.FB_URL, conf.FB_TOKEN).done(function() {
PathMonitor.process(esc, conf.FB_URL, conf.paths, conf.FB_PATH);
SearchQueue.init(esc, conf.FB_URL, conf.FB_REQ, conf.FB_RES, conf.CLEANUP_INTERVAL);
});