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