2018-12-18 17:38:18 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
const path = require('path')
|
|
|
|
const config = require(path.join(__dirname, 'control', 'config.js'))
|
2019-01-11 02:42:29 +00:00
|
|
|
let env = 'development'
|
|
|
|
let start = true
|
2018-12-18 17:38:18 +00:00
|
|
|
|
|
|
|
// Config grabber
|
|
|
|
for (let i in process.argv) {
|
|
|
|
let arg = process.argv[i]
|
|
|
|
if (arg === '-c') {
|
|
|
|
config.liq().then(
|
|
|
|
(dat) => console.log(dat),
|
|
|
|
(err) => {
|
|
|
|
console.error(err.stack)
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
)
|
2019-01-11 02:42:29 +00:00
|
|
|
start = false
|
2018-12-18 17:38:18 +00:00
|
|
|
} else if (arg === '-p') {
|
|
|
|
env = 'production'
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-11 02:42:29 +00:00
|
|
|
if (start) {
|
|
|
|
// Application starter
|
|
|
|
process.env.NODE_ENV = env
|
2018-12-18 17:38:18 +00:00
|
|
|
|
2019-01-11 02:42:29 +00:00
|
|
|
config.read().then(
|
|
|
|
(c) => require(path.join(__dirname, 'control')),
|
|
|
|
(e) => console.error(e.stack)
|
|
|
|
)
|
|
|
|
}
|