Fix environment variable casting (#4855)

Fixes #4628
This commit is contained in:
Félix Malfait
2024-04-05 18:15:47 +02:00
committed by GitHub
parent bbdb926687
commit bffd73e391
8 changed files with 21 additions and 37 deletions

View File

@ -1,7 +1,6 @@
import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@nestjs/common';
import { NestExpressApplication } from '@nestjs/platform-express';
import { ConfigService } from '@nestjs/config';
import * as Sentry from '@sentry/node';
import { graphqlUploadExpress } from 'graphql-upload';
@ -14,15 +13,13 @@ import { AppModule } from './app.module';
import { generateFrontConfig } from './utils/generate-front-config';
import { settings } from './engine/constants/settings';
import { LoggerService } from './engine/integrations/logger/logger.service';
import { EnvironmentService } from './engine/integrations/environment/environment.service';
const bootstrap = async () => {
const environmentService = new EnvironmentService(new ConfigService());
const app = await NestFactory.create<NestExpressApplication>(AppModule, {
cors: true,
bufferLogs: environmentService.get('LOGGER_IS_BUFFER_ENABLED'),
bufferLogs: process.env.LOGGER_IS_BUFFER_ENABLED === 'true',
rawBody: true,
snapshot: environmentService.get('DEBUG_MODE'),
snapshot: process.env.DEBUG_MODE === 'true',
});
const logger = app.get(LoggerService);
@ -64,7 +61,7 @@ const bootstrap = async () => {
// Create the env-config.js of the front at runtime
generateFrontConfig();
await app.listen(app.get(EnvironmentService).get('PORT'));
await app.listen(process.env.PORT ?? 3000);
};
bootstrap();