diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-20 03:27:03 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-20 03:27:03 +0200 |
commit | 04dea8d788acfaf485f4aa9ad255e39f6aac2a08 (patch) | |
tree | 2a61e45ef6f313012a585a0a80c1fa5bfe3ddae8 /src/Server.ts | |
parent | Fix merge conflicts (diff) | |
download | server-04dea8d788acfaf485f4aa9ad255e39f6aac2a08.tar.xz |
prettier
Diffstat (limited to 'src/Server.ts')
-rw-r--r-- | src/Server.ts | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/Server.ts b/src/Server.ts index 4d5d6422..c94c3bc7 100644 --- a/src/Server.ts +++ b/src/Server.ts @@ -1,15 +1,15 @@ process.on("unhandledRejection", console.error); process.on("uncaughtException", console.error); -import http from "http"; import * as Api from "@fosscord/api"; -import * as Gateway from "@fosscord/gateway"; import { CDNServer } from "@fosscord/cdn"; -import express from "express"; -import { green, bold, yellow } from "picocolors"; +import * as Gateway from "@fosscord/gateway"; import { Config, getOrInitialiseDatabase } from "@fosscord/util"; import * as Sentry from "@sentry/node"; import * as Tracing from "@sentry/tracing"; +import express from "express"; +import http from "http"; +import { bold, green, yellow } from "picocolors"; // import { PluginLoader } from "@fosscord/util"; const app = express(); @@ -26,12 +26,12 @@ const cdn = new CDNServer({ server, port, production, app }); const gateway = new Gateway.Server({ server, port, production }); //this is what has been added for the /stop API route -process.on('SIGTERM', () => { - setTimeout(()=>process.exit(0), 3000) +process.on("SIGTERM", () => { + setTimeout(() => process.exit(0), 3000); server.close(() => { - console.log("Stop API has been successfully POSTed, SIGTERM sent") - }) -}) + console.log("Stop API has been successfully POSTed, SIGTERM sent"); + }); +}); //this is what has been added for the /stop API route async function main() { @@ -42,16 +42,15 @@ async function main() { await Config.set({ cdn: { endpointClient: "${location.host}", - endpointPrivate: `http://localhost:${port}`, + endpointPrivate: `http://localhost:${port}` }, gateway: { - endpointClient: - '${location.protocol === "https:" ? "wss://" : "ws://"}${location.host}', + endpointClient: '${location.protocol === "https:" ? "wss://" : "ws://"}${location.host}', endpointPrivate: `ws://localhost:${port}`, ...(!Config.get().gateway.endpointPublic && { - endpointPublic: `ws://localhost:${port}`, - }), - }, + endpointPublic: `ws://localhost:${port}` + }) + } // regions: { // default: "fosscord", // useDefaultAsOptimal: true, @@ -70,15 +69,10 @@ async function main() { //Sentry if (Config.get().sentry.enabled) { - console.log( - `[Bundle] ${yellow("You are using Sentry! This may slightly impact performance on large loads!")}` - ); + console.log(`[Bundle] ${yellow("You are using Sentry! This may slightly impact performance on large loads!")}`); Sentry.init({ dsn: Config.get().sentry.endpoint, - integrations: [ - new Sentry.Integrations.Http({ tracing: true }), - new Tracing.Integrations.Express({ app }), - ], + integrations: [new Sentry.Integrations.Http({ tracing: true }), new Tracing.Integrations.Express({ app })], tracesSampleRate: Config.get().sentry.traceSampleRate, environment: Config.get().sentry.environment }); |