icytv-liq/index.js

35 lines
673 B
JavaScript

#!/usr/bin/env node
const path = require('path')
const config = require(path.join(__dirname, 'control', 'config.js'))
let env = 'development'
let start = true
// 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)
}
)
start = false
} else if (arg === '-p') {
env = 'production'
break
}
}
if (start) {
// Application starter
process.env.NODE_ENV = env
config.read().then(
(c) => require(path.join(__dirname, 'control')),
(e) => console.error(e.stack)
)
}