-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
31 lines (23 loc) · 834 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
const path = require('path')
const program = require('commander')
const ConfigServer = require(path.join(__dirname, 'lib', 'configserver.js'))
const InfluxLogger = require(path.join(__dirname, 'lib', 'influxlogger.js'))
const HMInterface = require('hm-interface')
let lfgPath = path.join('/', 'etc', 'config', 'addons', 'hm-influxdb')
program.option('-D, --debug', 'turn on debug level logging', () => {
HMInterface.logger.setDebugEnabled(true)
})
program.option('-C, --config [path]', 'set config path', (path) => {
lfgPath = path
})
program.parse(process.argv)
let logger = HMInterface.logger.logger('Main')
logger.info('Config Path is %s', lfgPath)
let il = new InfluxLogger(lfgPath)
let cs = new ConfigServer(lfgPath)
cs.attach(il)
cs.run()
process.on('SIGINT', async (code) => {
await il.stop()
process.exit()
})