mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Merge branch 'sentry-conf' into 'main'
Remove `@/config.ts` import when starting Sentry See merge request soapbox-pub/ditto!695
This commit is contained in:
commit
4b1d7c1502
4 changed files with 16 additions and 15 deletions
|
|
@ -12,6 +12,7 @@ import { NostrEvent, NostrSigner, NRelay, NUploader } from '@nostrify/nostrify';
|
||||||
|
|
||||||
import { cron } from '@/cron.ts';
|
import { cron } from '@/cron.ts';
|
||||||
import { startFirehose } from '@/firehose.ts';
|
import { startFirehose } from '@/firehose.ts';
|
||||||
|
import { startSentry } from '@/sentry.ts';
|
||||||
import { DittoAPIStore } from '@/storages/DittoAPIStore.ts';
|
import { DittoAPIStore } from '@/storages/DittoAPIStore.ts';
|
||||||
import { DittoPgStore } from '@/storages/DittoPgStore.ts';
|
import { DittoPgStore } from '@/storages/DittoPgStore.ts';
|
||||||
import { DittoPool } from '@/storages/DittoPool.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);
|
const conf = new DittoConf(Deno.env);
|
||||||
|
|
||||||
|
startSentry(conf);
|
||||||
|
|
||||||
const db = new DittoPolyPg(conf.databaseUrl, {
|
const db = new DittoPolyPg(conf.databaseUrl, {
|
||||||
poolSize: conf.pg.poolSize,
|
poolSize: conf.pg.poolSize,
|
||||||
debug: conf.pgliteDebug,
|
debug: conf.pgliteDebug,
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
import * as Sentry from '@sentry/deno';
|
import * as Sentry from '@sentry/deno';
|
||||||
import { logi } from '@soapbox/logi';
|
import { logi } from '@soapbox/logi';
|
||||||
|
|
||||||
import { Conf } from '@/config.ts';
|
import type { DittoConf } from '@ditto/conf';
|
||||||
|
|
||||||
// Sentry
|
/** Start Sentry, if configured. */
|
||||||
if (Conf.sentryDsn) {
|
export function startSentry(conf: DittoConf): void {
|
||||||
|
if (conf.sentryDsn) {
|
||||||
logi({ level: 'info', ns: 'ditto.sentry', msg: 'Sentry enabled.', enabled: true });
|
logi({ level: 'info', ns: 'ditto.sentry', msg: 'Sentry enabled.', enabled: true });
|
||||||
Sentry.init({
|
Sentry.init({ dsn: conf.sentryDsn });
|
||||||
dsn: Conf.sentryDsn,
|
|
||||||
tracesSampleRate: 1.0,
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
logi({ level: 'info', ns: 'ditto.sentry', msg: 'Sentry not configured. Skipping.', enabled: false });
|
logi({ level: 'info', ns: 'ditto.sentry', msg: 'Sentry not configured. Skipping.', enabled: false });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
|
import { DittoConf } from '@ditto/conf';
|
||||||
import { logi } from '@soapbox/logi';
|
import { logi } from '@soapbox/logi';
|
||||||
|
|
||||||
import '@/sentry.ts';
|
|
||||||
import '@/nostr-wasm.ts';
|
|
||||||
import app from '@/app.ts';
|
import app from '@/app.ts';
|
||||||
import { Conf } from '@/config.ts';
|
|
||||||
|
const conf = new DittoConf(Deno.env);
|
||||||
|
|
||||||
Deno.serve({
|
Deno.serve({
|
||||||
port: Conf.port,
|
port: conf.port,
|
||||||
onListen({ hostname, port }): void {
|
onListen({ hostname, port }): void {
|
||||||
logi({ level: 'info', ns: 'ditto.server', msg: `Listening on http://${hostname}:${port}`, hostname, port });
|
logi({ level: 'info', ns: 'ditto.server', msg: `Listening on http://${hostname}:${port}`, hostname, port });
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import * as Comlink from 'comlink';
|
||||||
import { VerifiedEvent, verifyEvent } from 'nostr-tools';
|
import { VerifiedEvent, verifyEvent } from 'nostr-tools';
|
||||||
|
|
||||||
import '@/nostr-wasm.ts';
|
import '@/nostr-wasm.ts';
|
||||||
import '@/sentry.ts';
|
|
||||||
|
|
||||||
export const VerifyWorker = {
|
export const VerifyWorker = {
|
||||||
verifyEvent(event: NostrEvent): event is VerifiedEvent {
|
verifyEvent(event: NostrEvent): event is VerifiedEvent {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue