hunk.code_window:   }
     await app.listen(process.env.PORT as string);
   }
   process.on('SIGTERM', () => {
     otelSDK
       .shutdown()
       .then(
         () => console.log('SDK shut down successfully'),
         (err) => console.log('Error shutting down SDK', err)
       )
       .finally(() => process.exit(0));
   });
hunk.labels: keep keep keep keep replace replace replace replace replace replace replace replace replace replace
hunk.file_path: apps/ws/src/bootstrap.ts
hunk.type: replace
file: import './config';
  import { INestApplication } from '@nestjs/common';
  import { NestFactory } from '@nestjs/core';
  import * as Sentry from '@sentry/node';
  import { getErrorInterceptor, Logger, initializeOtelSdk } from '@novu/application-generic';
  import * as packageJson from '../package.json';
  
  import { AppModule } from './app.module';
  
  if (process.env.SENTRY_DSN) {
    Sentry.init({
      dsn: process.env.SENTRY_DSN,
      environment: process.env.NODE_ENV,
      release: `v${packageJson.version}`,
    });
  }
  
  const otelSDK = initializeOtelSdk(packageJson.name);
  
  export async function bootstrap(): Promise<INestApplication> {
    if (process.env.ENABLE_OTEL === 'true') {
      await otelSDK.start();
    }
    const app = await NestFactory.create(AppModule, { bufferLogs: true });
  
    app.useLogger(app.get(Logger));
    app.flushLogs();
  
    app.useGlobalInterceptors(getErrorInterceptor());
  
    app.enableCors({
      origin: '*',
      preflightContinue: false,
      allowedHeaders: ['Content-Type', 'Authorization'],
      methods: ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
    });
  
    await app.listen(process.env.PORT);
  
    return app;
  }
  
  process.on('SIGTERM', () => {
    otelSDK
      .shutdown()
      .then(
        () => console.log('SDK shut down successfully'),
        (err) => console.log('Error shutting down SDK', err)
      )
      .finally(() => process.exit(0));
  });
  