feat(app): enable trust proxy and update app initialization
- Activated `trust proxy` setting to retrieve real IP behind reverse proxies. - Updated app initialization to use `NestExpressApplication`.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { Logger, ValidationPipe } from "@nestjs/common";
|
import { Logger, ValidationPipe } from "@nestjs/common";
|
||||||
import { ConfigService } from "@nestjs/config";
|
import { ConfigService } from "@nestjs/config";
|
||||||
import { NestFactory } from "@nestjs/core";
|
import { NestFactory } from "@nestjs/core";
|
||||||
|
import { NestExpressApplication } from "@nestjs/platform-express";
|
||||||
import * as Sentry from "@sentry/nestjs";
|
import * as Sentry from "@sentry/nestjs";
|
||||||
import { nodeProfilingIntegration } from "@sentry/profiling-node";
|
import { nodeProfilingIntegration } from "@sentry/profiling-node";
|
||||||
import helmet from "helmet";
|
import helmet from "helmet";
|
||||||
@@ -8,10 +9,13 @@ import { AppModule } from "./app.module";
|
|||||||
import { AllExceptionsFilter } from "./common/filters/http-exception.filter";
|
import { AllExceptionsFilter } from "./common/filters/http-exception.filter";
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
||||||
const configService = app.get(ConfigService);
|
const configService = app.get(ConfigService);
|
||||||
const logger = new Logger("Bootstrap");
|
const logger = new Logger("Bootstrap");
|
||||||
|
|
||||||
|
// Activer trust proxy pour récupérer l'IP réelle derrière un reverse proxy
|
||||||
|
app.set("trust proxy", true);
|
||||||
|
|
||||||
const sentryDsn = configService.get<string>("SENTRY_DSN");
|
const sentryDsn = configService.get<string>("SENTRY_DSN");
|
||||||
if (sentryDsn) {
|
if (sentryDsn) {
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
|
|||||||
Reference in New Issue
Block a user