Merge branch 'sentry' into 'main'

Add Sentry integration

See merge request soapbox-pub/ditto!48
This commit is contained in:
Alex Gleason 2023-10-05 21:10:08 +00:00
commit 980e20ac35
4 changed files with 18 additions and 3 deletions

View File

@ -2,9 +2,9 @@
"$schema": "https://deno.land/x/deno@v1.32.3/cli/schemas/config-file.v1.json", "$schema": "https://deno.land/x/deno@v1.32.3/cli/schemas/config-file.v1.json",
"lock": false, "lock": false,
"tasks": { "tasks": {
"start": "deno run --allow-read --allow-write=data --allow-env --allow-net src/server.ts", "start": "deno run --allow-read --allow-write=data --allow-env --allow-net --allow-sys src/server.ts",
"dev": "deno run --allow-read --allow-write=data --allow-env --allow-net --watch src/server.ts", "dev": "deno run --allow-read --allow-write=data --allow-env --allow-net --allow-sys --watch src/server.ts",
"debug": "deno run --allow-read --allow-write=data --allow-env --allow-net --inspect src/server.ts", "debug": "deno run --allow-read --allow-write=data --allow-env --allow-net --allow-sys --inspect src/server.ts",
"test": "DB_PATH=\":memory:\" deno test --allow-read --allow-write=data --allow-env src", "test": "DB_PATH=\":memory:\" deno test --allow-read --allow-write=data --allow-env src",
"check": "deno check src/server.ts", "check": "deno check src/server.ts",
"relays:sync": "deno run -A scripts/relays.ts sync" "relays:sync": "deno run -A scripts/relays.ts sync"

View File

@ -144,6 +144,9 @@ const Conf = {
local(path: string): string { local(path: string): string {
return mergePaths(Conf.localDomain, path); return mergePaths(Conf.localDomain, path);
}, },
get sentryDsn() {
return Deno.env.get('SENTRY_DSN');
},
}; };
const optionalBooleanSchema = z const optionalBooleanSchema = z

View File

@ -72,5 +72,6 @@ export { S3Client } from 'https://deno.land/x/s3_lite_client@0.6.1/mod.ts';
export { default as IpfsHash } from 'npm:ipfs-only-hash@^4.0.0'; export { default as IpfsHash } from 'npm:ipfs-only-hash@^4.0.0';
export { default as uuid62 } from 'npm:uuid62@^1.0.2'; export { default as uuid62 } from 'npm:uuid62@^1.0.2';
export { Machina } from 'https://gitlab.com/soapbox-pub/nostr-machina/-/raw/08a157d39f2741c9a3a4364cb97db36e71d8c03a/mod.ts'; export { Machina } from 'https://gitlab.com/soapbox-pub/nostr-machina/-/raw/08a157d39f2741c9a3a4364cb97db36e71d8c03a/mod.ts';
export * as Sentry from 'npm:@sentry/node@^7.73.0';
export type * as TypeFest from 'npm:type-fest@^4.3.0'; export type * as TypeFest from 'npm:type-fest@^4.3.0';

View File

@ -1,4 +1,15 @@
import './precheck.ts'; import './precheck.ts';
import app from './app.ts'; import app from './app.ts';
import { Conf } from './config.ts';
import { Sentry } from './deps.ts';
// Sentry
if (Conf.sentryDsn) {
console.log('Sentry enabled');
Sentry.init({
dsn: Conf.sentryDsn,
tracesSampleRate: 1.0,
});
}
Deno.serve(app.fetch); Deno.serve(app.fetch);