Remove @/config.ts import when starting Sentry

This commit is contained in:
Alex Gleason 2025-02-27 13:51:57 -06:00
parent 92da5e6ac3
commit 432f65ff61
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
4 changed files with 16 additions and 15 deletions

View file

@ -12,6 +12,7 @@ import { NostrEvent, NostrSigner, NRelay, NUploader } from '@nostrify/nostrify';
import { cron } from '@/cron.ts';
import { startFirehose } from '@/firehose.ts';
import { startSentry } from '@/sentry.ts';
import { DittoAPIStore } from '@/storages/DittoAPIStore.ts';
import { DittoPgStore } from '@/storages/DittoPgStore.ts';
import { DittoPool } from '@/storages/DittoPool.ts';
@ -182,6 +183,8 @@ type AppController<P extends string = any> = Handler<AppEnv, P, HonoInput, Respo
const conf = new DittoConf(Deno.env);
startSentry(conf);
const db = new DittoPolyPg(conf.databaseUrl, {
poolSize: conf.pg.poolSize,
debug: conf.pgliteDebug,

View file

@ -1,15 +1,14 @@
import * as Sentry from '@sentry/deno';
import { logi } from '@soapbox/logi';
import { Conf } from '@/config.ts';
import type { DittoConf } from '@ditto/conf';
// Sentry
if (Conf.sentryDsn) {
logi({ level: 'info', ns: 'ditto.sentry', msg: 'Sentry enabled.', enabled: true });
Sentry.init({
dsn: Conf.sentryDsn,
tracesSampleRate: 1.0,
});
} else {
logi({ level: 'info', ns: 'ditto.sentry', msg: 'Sentry not configured. Skipping.', enabled: false });
/** Start Sentry, if configured. */
export function startSentry(conf: DittoConf): void {
if (conf.sentryDsn) {
logi({ level: 'info', ns: 'ditto.sentry', msg: 'Sentry enabled.', enabled: true });
Sentry.init({ dsn: conf.sentryDsn });
} else {
logi({ level: 'info', ns: 'ditto.sentry', msg: 'Sentry not configured. Skipping.', enabled: false });
}
}

View file

@ -1,12 +1,12 @@
import { DittoConf } from '@ditto/conf';
import { logi } from '@soapbox/logi';
import '@/sentry.ts';
import '@/nostr-wasm.ts';
import app from '@/app.ts';
import { Conf } from '@/config.ts';
const conf = new DittoConf(Deno.env);
Deno.serve({
port: Conf.port,
port: conf.port,
onListen({ hostname, port }): void {
logi({ level: 'info', ns: 'ditto.server', msg: `Listening on http://${hostname}:${port}`, hostname, port });
},

View file

@ -3,7 +3,6 @@ import * as Comlink from 'comlink';
import { VerifiedEvent, verifyEvent } from 'nostr-tools';
import '@/nostr-wasm.ts';
import '@/sentry.ts';
export const VerifyWorker = {
verifyEvent(event: NostrEvent): event is VerifiedEvent {