-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.js
33 lines (28 loc) · 810 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
33
#!/usr/bin/env node
'use strict';
var commander = require('commander');
var src = require('./src/program');
commander
.version(require('./package.json').version)
.option('-q, --quiet',
'Won\'t log');
commander
.command('live <max>')
.description('Indefinitely report latest crawl metrics from db to graphite')
.action(function(max) {
var queueUrl = process.env.SQS_URL;
var dbUrl = process.env.HBASE_URL;
var graphiteUrl = process.env.GRAPHITE_URL;
var log = !commander.quiet;
if (queueUrl && dbUrl) {
src.live(max, queueUrl, dbUrl, graphiteUrl, log);
} else {
console.error("Missing environment variable.")
commander.outputHelp();
}
});
commander
.parse(process.argv);
if (!process.argv.slice(2).length) {
commander.outputHelp();
}