Lingui working with NODE ENV=production again (#10067)

Lingui now offers an option to disable stripping even in prod mode so we
can bring it back
This commit is contained in:
Félix Malfait
2025-02-07 10:05:07 +01:00
committed by GitHub
parent 12cec01d80
commit 8df59c085d
21 changed files with 56 additions and 45 deletions

View File

@ -1,5 +1,7 @@
import { Query, Resolver } from '@nestjs/graphql';
import { NodeEnvironment } from 'src/engine/core-modules/environment/interfaces/node-environment.interface';
import { DomainManagerService } from 'src/engine/core-modules/domain-manager/services/domain-manager.service';
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
import { PUBLIC_FEATURE_FLAGS } from 'src/engine/core-modules/feature-flag/constants/public-feature-flag.const';
@ -50,7 +52,7 @@ export class ClientConfigResolver {
),
defaultSubdomain: this.environmentService.get('DEFAULT_SUBDOMAIN'),
frontDomain: this.domainManagerService.getFrontUrl().hostname,
debugMode: this.environmentService.get('DEBUG_MODE'),
debugMode: this.environmentService.get('NODE_ENV') === 'development',
support: {
supportDriver: this.environmentService.get('SUPPORT_DRIVER'),
supportFrontChatId: this.environmentService.get(
@ -74,7 +76,8 @@ export class ClientConfigResolver {
},
analyticsEnabled: this.environmentService.get('ANALYTICS_ENABLED'),
canManageFeatureFlags:
this.environmentService.get('DEBUG_MODE') ||
this.environmentService.get('NODE_ENV') ===
NodeEnvironment.development ||
this.environmentService.get('IS_BILLING_ENABLED'),
publicFeatureFlags: PUBLIC_FEATURE_FLAGS,
isMicrosoftMessagingEnabled: this.environmentService.get(

View File

@ -795,22 +795,13 @@ export class EnvironmentVariables {
})
REDIS_URL: string;
@EnvironmentVariablesMetadata({
group: EnvironmentVariablesGroup.ServerConfig,
description: 'Enable or disable debug mode for the application',
})
@CastToBoolean()
@IsOptional()
@IsBoolean()
DEBUG_MODE = false;
@EnvironmentVariablesMetadata({
group: EnvironmentVariablesGroup.ServerConfig,
description: 'Node environment (development, production, etc.)',
})
@IsEnum(NodeEnvironment)
@IsString()
NODE_ENV: NodeEnvironment = NodeEnvironment.development;
NODE_ENV: NodeEnvironment = NodeEnvironment.production;
@EnvironmentVariablesMetadata({
group: EnvironmentVariablesGroup.ServerConfig,

View File

@ -30,7 +30,7 @@ export const exceptionHandlerModuleFactory = async (
release: environmentService.get('SENTRY_RELEASE'),
dsn: environmentService.get('SENTRY_DSN') ?? '',
serverInstance: adapterHost.httpAdapter?.getInstance(),
debug: environmentService.get('DEBUG_MODE'),
debug: environmentService.get('NODE_ENV') === 'development',
},
};
}

View File

@ -1,3 +1,5 @@
import { NodeEnvironment } from 'src/engine/core-modules/environment/interfaces/node-environment.interface';
import {
BaseGraphQLError,
ErrorCode,
@ -9,7 +11,7 @@ export const generateGraphQLErrorFromError = (error: Error) => {
ErrorCode.INTERNAL_SERVER_ERROR,
);
if (process.env.NODE_ENV === 'development') {
if (process.env.NODE_ENV === NodeEnvironment.development) {
graphqlError.stack = error.stack;
graphqlError.extensions['response'] = error.message;
}