diff options
Diffstat (limited to 'src/cdn')
-rw-r--r-- | src/cdn/Server.ts | 6 | ||||
-rw-r--r-- | src/cdn/start.ts | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/cdn/Server.ts b/src/cdn/Server.ts index 7340a735..abf59a2a 100644 --- a/src/cdn/Server.ts +++ b/src/cdn/Server.ts @@ -1,5 +1,5 @@ import { Server, ServerOptions } from "lambert-server"; -import { Config, initDatabase, registerRoutes } from "@fosscord/util"; +import { Config, initDatabase, registerRoutes, Sentry } from "@fosscord/util"; import path from "path"; import avatarsRoute from "./routes/avatars"; import guildProfilesRoute from "./routes/guild-profiles"; @@ -18,6 +18,8 @@ export class CDNServer extends Server { async start() { await initDatabase(); await Config.init(); + await Sentry.init(this.app); + this.app.use((req, res, next) => { res.set("Access-Control-Allow-Origin", "*"); // TODO: use better CSP policy @@ -87,6 +89,8 @@ export class CDNServer extends Server { ); this.log("verbose", "[Server] Route /guilds/banners registered"); + Sentry.errorHandler(this.app); + return super.start(); } diff --git a/src/cdn/start.ts b/src/cdn/start.ts index c22984fa..4b619c25 100644 --- a/src/cdn/start.ts +++ b/src/cdn/start.ts @@ -1,6 +1,5 @@ require("module-alias/register"); -import dotenv from "dotenv"; -dotenv.config(); +import "dotenv/config"; import { CDNServer } from "./Server"; const server = new CDNServer({ port: Number(process.env.PORT) || 3003 }); |