From 3a6be90862facd430237eebccaec3538924e1765 Mon Sep 17 00:00:00 2001 From: Timon Masberg Date: Thu, 1 Feb 2024 15:27:24 +0100 Subject: [PATCH] chore(api): init prod dependencies only in next and prod environments --- apps/api/src/app/app.module.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/api/src/app/app.module.ts b/apps/api/src/app/app.module.ts index 04a56f96..006b4e4e 100644 --- a/apps/api/src/app/app.module.ts +++ b/apps/api/src/app/app.module.ts @@ -18,14 +18,15 @@ import { GraphqlSubscriptionsController } from './controllers/graphql-subscripti import { HealthCheckController } from './controllers/health-check.controller'; import environment from './environment'; -// todo: narrow this down, we should have either an explicit way of defining when to use what (currently hard, since ConfigService not available in forRoot), or we should have an environment variable that defines the environment -const isProdEnv = - process.env.NODE_ENV === 'production' && !process.env.GITHUB_ACTIONS; +const isNextOrProdEnv = ['next', 'prod'].includes( + process.env.ENVIRONMENT_NAME ?? '', +); + const FEATURE_MODULES = [OrganizationModule]; const UTILITY_MODULES = [ SharedKernel, - AuthModule.forRoot(isProdEnv ? 'aadb2c' : 'dev'), - ObservabilityModule.forRoot(isProdEnv ? 'sentry' : 'dev'), + AuthModule.forRoot(isNextOrProdEnv ? 'aadb2c' : 'dev'), + ObservabilityModule.forRoot(isNextOrProdEnv ? 'sentry' : 'dev'), ]; @Module({