Skip to content

Commit

Permalink
feat: add server name to sentry init
Browse files Browse the repository at this point in the history
  • Loading branch information
panuhorsmalahti committed Jun 25, 2024
1 parent 4e5a28a commit 2675c91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { captureException, initExceptionHandler } from "./src/error-reporter";
process.title = "bored";
console.log(`~~ BoreD v${version} ~~`);

initExceptionHandler();

const tunnelAddress = process.env.TUNNEL_ADDRESS || "";

initExceptionHandler(tunnelAddress);

const serverPort = parseInt(process.env.PORT || "8080");
const agentToken = process.env.AGENT_TOKEN || "";
Expand Down Expand Up @@ -35,4 +38,4 @@ process.once("SIGINT", () => {
process.exit(0);
});

server.start(serverPort, agentToken, idpPublicKey);
server.start(serverPort, agentToken, idpPublicKey, tunnelAddress);
5 changes: 3 additions & 2 deletions src/error-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import * as Sentry from "@sentry/node";

let enabled = false;

export function initExceptionHandler() {
export function initExceptionHandler(tunnelAddress: string) {
if (process.env.SENTRY_DSN) {
enabled = true;
Sentry.init({
dsn: process.env.SENTRY_DSN
dsn: process.env.SENTRY_DSN,
serverName: tunnelAddress
});
console.log("ERROR-REPORTER: reporting enabled");
}
Expand Down

0 comments on commit 2675c91

Please sign in to comment.