-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (26 loc) · 865 Bytes
/
index.js
File metadata and controls
33 lines (26 loc) · 865 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
const args = require('minimist')(process.argv.slice(2))
const logger = require('./src/helpers/logger')
const Controller = require('./src/controller')
if (args.help) {
help()
process.exit(0)
}
logger.info('App started')
const controller = new Controller(args)
controller.run()
function help() {
console.info('help - print help')
console.info('hint - runs handler with this interval, default value 10 sec')
console.info('gint - runs generator with this interval, default value 10 sec')
console.info('ngtimeout - alert timeout without any generator in system, default 100 sec')
}
const onTerminate = async () => {
await controller.unregister()
process.exit()
}
process.on('SIGINT', onTerminate)
process.on('SIGTERM', onTerminate)
process.on('uncaughtException', (err) => {
logger.error('uncaughtException: ', err.message)
process.exit(1)
})