forked from bitfinexcom/bfx-svc-boot-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (33 loc) · 618 Bytes
/
index.js
File metadata and controls
38 lines (33 loc) · 618 Bytes
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
37
38
'use strict'
const cmd = require('yargs')
.option('wtype', {
demand: true,
type: 'string'
})
.option('env', {
choices: ['production', 'development', 'staging', 'test'],
demand: true,
type: 'string'
})
.option('debug', {
default: false,
type: 'boolean'
})
.help('help')
.argv
const hnd = require('./lib/worker.js')(cmd)
let shutdown = 0
process.on('SIGINT', () => {
if (shutdown) {
return
}
shutdown = 1
if (!hnd.active) {
return
}
console.log('BKW', process.title, 'shutting down')
hnd.stop(() => {
process.exit()
})
})
module.exports = hnd