Wisp logging bs

This commit is contained in:
MotorTruck1221 2024-10-13 05:17:21 -06:00
parent 620ad25c61
commit 35680e719b
No known key found for this signature in database
GPG key ID: 08F417E2B8B61EA4
2 changed files with 8 additions and 2 deletions

View file

@ -3,6 +3,7 @@ import wisp from 'wisp-server-node';
import rammerhead from '@rubynetwork/rammerhead';
import { FastifyServerFactory, FastifyServerFactoryHandler, RawServerDefault } from 'fastify';
import { parsedDoc } from './config.js';
import { LOG_LEVEL, WispOptions } from 'wisp-server-node/dist/Types.js';
const rh = rammerhead.createRammerhead({
logLevel: parsedDoc.server.server.logging ? 'debug' : 'disabled',
@ -11,6 +12,11 @@ const rh = rammerhead.createRammerhead({
disableHttp2: parsedDoc.server.rammerhead.http2 ? false : true
});
const wispOptions: WispOptions = {
logLevel: parsedDoc.server.server.logging ? LOG_LEVEL.DEBUG : LOG_LEVEL.NONE,
pingInterval: 30
}
const serverFactory: FastifyServerFactory = (handler: FastifyServerFactoryHandler): RawServerDefault => {
const httpServer = createServer();
httpServer.on('request', (req, res) => {
@ -27,7 +33,7 @@ const serverFactory: FastifyServerFactory = (handler: FastifyServerFactoryHandle
}
else if (parsedDoc.server.server.wisp) {
if (req.url?.endsWith('/wisp/')) {
wisp.routeRequest(req, socket as any, head);
wisp.routeRequest(req, socket as any, head, wispOptions);
}
}
});

View file

@ -6,7 +6,7 @@ import Pagnation from "./pagnation.astro";
const { page } = Astro.params;
const response = await fetch(new URL("/api/catalog-assets/", Astro.url));
console.log(new URL("/api/catalog-assets/", Astro.url));
//console.log(new URL("/api/catalog-assets/", Astro.url));
const assetsJson = await response.json();
const nextPage = parseInt(page!) + 1;