39 lines
861 B
JavaScript
Executable file
39 lines
861 B
JavaScript
Executable file
import minimist from 'minimist'
|
|
import { run } from './server.mjs'
|
|
import p from 'path'
|
|
import createDebug from 'debug'
|
|
import Dotenv from 'dotenv'
|
|
|
|
Dotenv.config({ path: p.resolve(p.join(process.cwd(), '..', '.env')) })
|
|
Dotenv.config()
|
|
|
|
const debug = createDebug('streamer')
|
|
|
|
main().catch(onerror)
|
|
|
|
async function main () {
|
|
const args = minimist(process.argv.slice(2), {
|
|
default: {
|
|
port: process.env.PORT || 3030,
|
|
host: '0.0.0.0',
|
|
input: process.env.STUDIOX_INPUT || 'alsa:hifiberry',
|
|
output: process.env.STUDIOX_OUTPUT || 'alsa:hifiberry',
|
|
dev: false
|
|
},
|
|
alias: {
|
|
p: 'port',
|
|
h: 'host',
|
|
i: 'input',
|
|
o: 'output',
|
|
d: 'dev'
|
|
}
|
|
})
|
|
|
|
await run(args)
|
|
}
|
|
|
|
function onerror (err) {
|
|
if (err) console.error(err instanceof Error ? err.message : String(err))
|
|
debug(err)
|
|
process.exit(1)
|
|
}
|