mirror of
https://github.com/streamwall/streamwall.git
synced 2026-01-24 14:12:48 -05:00
Debug logging
This commit is contained in:
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -12,6 +12,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version: 18.x
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm test
|
- run: npm test -- --silent=false
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
|
|||||||
@@ -247,8 +247,10 @@ export default async function initWebServer({
|
|||||||
let { protocol, hostname, port } = new URL(baseURL)
|
let { protocol, hostname, port } = new URL(baseURL)
|
||||||
if (!port) {
|
if (!port) {
|
||||||
port = protocol === 'https:' ? 443 : 80
|
port = protocol === 'https:' ? 443 : 80
|
||||||
|
console.debug(`No port specified in URL, defaulting to ${port}`)
|
||||||
}
|
}
|
||||||
if (overridePort) {
|
if (overridePort) {
|
||||||
|
console.debug(`Overriding port ${port} with ${overridePort}`)
|
||||||
port = overridePort
|
port = overridePort
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +265,9 @@ export default async function initWebServer({
|
|||||||
})
|
})
|
||||||
|
|
||||||
let server
|
let server
|
||||||
|
console.debug(`Starting server on ${protocol}//${hostname}:${port}`)
|
||||||
if (protocol === 'https:' && certDir) {
|
if (protocol === 'https:' && certDir) {
|
||||||
|
console.debug('Using HTTPS with certificate from', certDir)
|
||||||
const { key, cert } = await simpleCert({
|
const { key, cert } = await simpleCert({
|
||||||
dataDir: certDir,
|
dataDir: certDir,
|
||||||
commonName: hostname,
|
commonName: hostname,
|
||||||
@@ -278,6 +282,7 @@ export default async function initWebServer({
|
|||||||
|
|
||||||
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(`Server started on ${protocol}//${hostname}:${port}`)
|
||||||
|
|
||||||
return { server }
|
return { server }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,12 +63,14 @@ describe('streamwall server', () => {
|
|||||||
stateDoc,
|
stateDoc,
|
||||||
}))
|
}))
|
||||||
request = supertest(server)
|
request = supertest(server)
|
||||||
|
console.debug(`Server listening on ${baseURL}`)
|
||||||
auth.on('state', (authState) => {
|
auth.on('state', (authState) => {
|
||||||
clientState.update({ auth: authState })
|
clientState.update({ auth: authState })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
console.debug('Closing server')
|
||||||
server.close()
|
server.close()
|
||||||
for (const ws of sockets) {
|
for (const ws of sockets) {
|
||||||
ws.close()
|
ws.close()
|
||||||
@@ -76,11 +78,12 @@ describe('streamwall server', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function socket(options) {
|
function socket(options) {
|
||||||
|
console.debug(`Creating websocket at ${hostname}:${port}`)
|
||||||
const ws = new WebSocket(`ws://${hostname}:${port}/ws`, [], {
|
const ws = new WebSocket(`ws://${hostname}:${port}/ws`, [], {
|
||||||
...options,
|
...options,
|
||||||
origin: baseURL,
|
origin: baseURL,
|
||||||
})
|
})
|
||||||
sockets.push(ws)
|
console.debug(`Websocket created at ${hostname}:${port}`)
|
||||||
|
|
||||||
const msgs = on(ws, 'message')
|
const msgs = on(ws, 'message')
|
||||||
|
|
||||||
@@ -102,6 +105,7 @@ describe('streamwall server', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function socketFromSecret(secret) {
|
function socketFromSecret(secret) {
|
||||||
|
console.debug("Socket from secret")
|
||||||
return socket({
|
return socket({
|
||||||
headers: { Cookie: `${SESSION_COOKIE_NAME}=${secret}` },
|
headers: { Cookie: `${SESSION_COOKIE_NAME}=${secret}` },
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user