icytv-liq/index.js
2019-01-11 19:36:58 +02:00

37 lines
749 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
} else if (arg === '-s') {
process.env.LIQUIDSOAP_AUTOSTART = 'false'
}
}
if (start) {
// Application starter
process.env.NODE_ENV = env
config.read().then(
(c) => require(path.join(__dirname, 'control')),
(e) => console.error(e.stack)
)
}