-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.js
28 lines (25 loc) · 1.09 KB
/
worker.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
#!/usr/bin/env node
const path = require('path');
const Application = require('./src/app');
const argv = require('yargs')
.usage('Usage: $0 --config=<config-path>\nUsage standalone: $0 --dir=<directory> --test=<test-name>')
.default('config', `${__dirname}/config/default.json`)
.describe('config', 'Configuration file to load')
.describe('dir', 'Directory with tests for standalone mode')
.describe('test', 'Test name to launch in standalone mode')
.help('h')
.alias('h', 'help')
.example('$0 --config=/opt/zemog/production.json', 'Launches worker with the imaginary production config')
.example('$0 --dir=/opt/tests/ --test=connectionTest', 'Launches worker in standalone mode to run connectionTest')
.epilog('Auto & General (c)')
.argv;
const app = new Application(path.normalize(argv.config.replace('./', __dirname + '/')));
// Run a standalone mode without access to AWS to use local tests
// if --dir and --test arguments are passed
if (argv.dir && argv.test) {
app.startStandalone(argv.dir, argv.test);
}
// otherwise use normal mode which requires access to AWS S3 and SQS
else {
app.start();
}