lay the ground work for sentry integration

This commit is contained in:
Amruth Pillai
2022-11-25 11:32:57 +01:00
parent 77c587681b
commit aec78cf875
15 changed files with 461 additions and 5 deletions

View File

@ -1,7 +1,10 @@
import '@sentry/tracing';
import { Logger, ValidationPipe } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import * as Sentry from '@sentry/node';
import cookieParser from 'cookie-parser';
import { AppModule } from './app.module';
@ -18,6 +21,16 @@ const bootstrap = async () => {
// Pipes
app.useGlobalPipes(new ValidationPipe({ transform: true }));
// Sentry Error Logging
const sentryDSN = configService.get<string>('logging.sentryDSN');
if (sentryDSN) {
Sentry.init({
dsn: sentryDSN,
tracesSampleRate: 1.0,
enabled: process.env.NODE_ENV === 'production',
});
}
// Server Port
const port = configService.get<number>('app.port');
await app.listen(port);