summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-09-24 18:28:07 +0200
committerRory& <root@rory.gay>2026-09-24 18:28:07 +0200
commitd211b0d3a4b159b4b4815aeb355df738751c969b (patch)
treed40502e97cf5d65383daeef33b8d63e4080a72a6
parentFix type annotations for UserProfileModifySchema (diff)
downloadserver-ts-d211b0d3a4b159b4b4815aeb355df738751c969b.tar.xz
Gateway: use provided HTTP server if one is passed
-rw-r--r--src/gateway/Server.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gateway/Server.ts b/src/gateway/Server.ts

index 1bc4292ca..f34c1d020 100644 --- a/src/gateway/Server.ts +++ b/src/gateway/Server.ts
@@ -17,19 +17,18 @@ */ import http from "node:http"; +import path from "node:path"; +import morgan from "morgan"; +import { red } from "picocolors"; import ws from "ws"; import { Server, ServerOptions } from "lambert-server"; import { initDatabase } from "@spacebar/database"; -import { Random } from "@spacebar/extensions"; import { Config, initEvent, JSONReplacer, JwtKeypairManager, registerRoutes } from "@spacebar/util"; import { ProcessLifecycle, SystemdLifecycle } from "../util/util/ProcessLifecycle"; import { Monitoring } from "../util/monitoring/Monitoring"; import { Connection } from "./events/Connection"; import { cleanupOnStartup } from "./util"; -import morgan from "morgan"; import { Authentication, BodyParser, CORS, ErrorHandler } from "@spacebar/api"; -import path from "node:path"; -import { red } from "picocolors"; export class GatewayServer extends Server { public ws: ws.Server; @@ -37,7 +36,7 @@ export class GatewayServer extends Server { constructor(options?: Partial<ServerOptions>) { super(options); - this.http = http.createServer(this.app); + this.http ??= http.createServer(this.app); this.http.on("upgrade", (request, socket, head) => { this.ws.handleUpgrade(request, socket, head, (socket) => {