From 810f5dd84cab8249f90276ce3acde5ffe6938c8d Mon Sep 17 00:00:00 2001 From: Samuel <34555296+Flam3rboy@users.noreply.github.com> Date: Fri, 17 Mar 2023 17:47:43 +0100 Subject: perf: cache jwt secret as key --- src/api/Server.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/api/Server.ts') diff --git a/src/api/Server.ts b/src/api/Server.ts index 49229494..ced82dce 100644 --- a/src/api/Server.ts +++ b/src/api/Server.ts @@ -32,7 +32,7 @@ import "missing-native-js-functions"; import morgan from "morgan"; import path from "path"; import { red } from "picocolors"; -import { Authentication, CORS } from "./middlewares/"; +import { CORS, initAuthentication } from "./middlewares/"; import { BodyParser } from "./middlewares/BodyParser"; import { ErrorHandler } from "./middlewares/ErrorHandler"; import { initRateLimits } from "./middlewares/RateLimit"; @@ -97,7 +97,7 @@ export class FosscordServer extends Server { // @ts-ignore this.app = api; - api.use(Authentication); + initAuthentication(api); await initRateLimits(api); await initTranslation(api); @@ -126,6 +126,10 @@ export class FosscordServer extends Server { app.use("/api/v9", api); app.use("/api", api); // allow unversioned requests + try { + require("./middlewares/TestClient").default(this.app); + // eslint-disable-next-line no-empty + } catch (error) {} this.app.use(ErrorHandler); Sentry.errorHandler(this.app); -- cgit 1.5.1