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