Switch to using Docker file deployment

This commit is contained in:
Peter Stockings
2026-01-01 16:29:57 +11:00
parent 3a651c5bc8
commit 061f25fdcb
4 changed files with 42 additions and 17 deletions

View File

@@ -1,11 +1,8 @@
console.log("Imports loading...");
import { parseMagnetURI, BencodeDecoder, BencodeEncoder, MetadataReassembler } from "@torrent-client/shared";
console.log("Shared loaded");
import dgram from "node:dgram";
import crypto from "node:crypto";
import { join } from "node:path";
import { TorrentManager } from "./engine";
console.log("Engine loaded");
const port = process.env.PORT || 3001;
const getCONFIG = () => ({
@@ -312,18 +309,9 @@ export async function handleRequest(req: Request): Promise<Response> {
return new Response(Bun.file(join(distPath, "index.html")));
}
console.log("Server process starting...");
try {
if (process.env.NODE_ENV !== "test") {
console.log(`Attempting to bind parameters: PORT=${port}`);
const server = Bun.serve({
port: port,
fetch: handleRequest
});
console.log(`Server successfully listening on port ${server.port}`);
}
} catch (e) {
console.error("CRITICAL SERVER STARTUP ERROR:", e);
process.exit(1);
if (process.env.NODE_ENV !== "test") {
Bun.serve({
port: port,
fetch: handleRequest
});
}