mirror of
https://github.com/streamwall/streamwall.git
synced 2026-01-31 01:12:48 -05:00
Get webserver to start
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
"description": "View streams in a grid",
|
"description": "View streams in a grid",
|
||||||
"main": "./.webpack/main",
|
"main": "./.webpack/main",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron-forge start",
|
"start": "electron-forge start -- --control.address=http://localhost:4444 --control.username=admin --control.password=password",
|
||||||
"make": "electron-forge make",
|
"make": "electron-forge make",
|
||||||
"package": "electron-forge package",
|
"package": "electron-forge package",
|
||||||
"publish": "electron-forge publish",
|
"publish": "electron-forge publish",
|
||||||
|
|||||||
@@ -381,7 +381,8 @@ async function main(argv) {
|
|||||||
|
|
||||||
if (argv.control.address) {
|
if (argv.control.address) {
|
||||||
console.debug('Initializing web server...')
|
console.debug('Initializing web server...')
|
||||||
const webDistPath = path.join(app.getAppPath(), './web')
|
const webDistPath = path.join(app.getAppPath(), './.webpack/main/web')
|
||||||
|
console.debug('Web dist path:', webDistPath)
|
||||||
await initWebServer({
|
await initWebServer({
|
||||||
certDir: argv.cert.dir,
|
certDir: argv.cert.dir,
|
||||||
certProduction: argv.cert.production,
|
certProduction: argv.cert.production,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function initApp({
|
|||||||
const app = new Koa()
|
const app = new Koa()
|
||||||
|
|
||||||
// silence koa printing errors when websockets close early
|
// silence koa printing errors when websockets close early
|
||||||
app.silent = true
|
// app.silent = true
|
||||||
|
|
||||||
app.use(views(webDistPath, { extension: 'ejs' }))
|
app.use(views(webDistPath, { extension: 'ejs' }))
|
||||||
app.use(serveStatic(webDistPath))
|
app.use(serveStatic(webDistPath))
|
||||||
@@ -264,6 +264,17 @@ export default async function initWebServer({
|
|||||||
stateDoc,
|
stateDoc,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.debug(`App initialized with args:`, {
|
||||||
|
certDir,
|
||||||
|
certProduction,
|
||||||
|
email,
|
||||||
|
baseURL,
|
||||||
|
overrideHostname,
|
||||||
|
overridePort,
|
||||||
|
webDistPath,
|
||||||
|
logEnabled,
|
||||||
|
})
|
||||||
|
|
||||||
let server
|
let server
|
||||||
if (protocol === 'https:' && certDir) {
|
if (protocol === 'https:' && certDir) {
|
||||||
const { key, cert } = await simpleCert({
|
const { key, cert } = await simpleCert({
|
||||||
@@ -277,9 +288,12 @@ export default async function initWebServer({
|
|||||||
} else {
|
} else {
|
||||||
server = http.createServer(app.callback())
|
server = http.createServer(app.callback())
|
||||||
}
|
}
|
||||||
|
console.debug("Server started.")
|
||||||
|
|
||||||
const listen = promisify(server.listen).bind(server)
|
const listen = promisify(server.listen).bind(server)
|
||||||
await listen(port, overrideHostname || hostname)
|
await listen(port, overrideHostname || hostname)
|
||||||
|
|
||||||
|
console.debug('Web server listening:', { hostname, port })
|
||||||
|
|
||||||
return { server }
|
return { server }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user