forked from DustinJSilk/gekkoga-plus-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.js
36 lines (27 loc) · 859 Bytes
/
run.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
const Ga = require('./');
const fs = require('fs');
var runGA = require('commander');
runGA
.version('0.1.0')
.option('-c, --config <config file>', 'config')
.option('-u, --ui', 'UI')
.parse(process.argv);
if(!runGA.ui && (!runGA.config||!fs.existsSync(runGA.config))){
console.warn("\n"," error: option `-c --config <config file>' argument or file missing","\n");
process.on('message', msg => {
runWithConfig(msg);
process.send(msg);
});
process.send({needConfig: true});
}
if (runGA.ui) {
const server = require('./server.js');
} else if (runGA.config) {
runWithConfig(runGA.config);
}
function runWithConfig(configFile) {
const config = require(__dirname + '/' + configFile);
console.log(config.notifications, config);
const ga = new Ga(config, configFile, false);
ga.run().catch(err => console.error(err) );
}