From 724b9e00eefd8432ce7259a120bf6daada5dc374 Mon Sep 17 00:00:00 2001 From: samuel Date: Fri, 28 Jun 2024 18:51:07 +0200 Subject: [PATCH] Remove Bullboard from Prod --- .../src/orchestration/orchestration.module.ts | 12 ++++++++---- .../src/shared/module/queue/queue.module.ts | 15 ++++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/apps/armory/src/orchestration/orchestration.module.ts b/apps/armory/src/orchestration/orchestration.module.ts index 7d5a08de2..fb139a84c 100644 --- a/apps/armory/src/orchestration/orchestration.module.ts +++ b/apps/armory/src/orchestration/orchestration.module.ts @@ -4,6 +4,7 @@ import { ConfigModule } from '@narval/config-module' import { HttpModule } from '@nestjs/axios' import { BullModule } from '@nestjs/bull' import { Module } from '@nestjs/common' +import { ConditionalModule } from '@nestjs/config' import { load } from '../armory.config' import { AUTHORIZATION_REQUEST_PROCESSING_QUEUE, DEFAULT_HTTP_MODULE_PROVIDERS } from '../armory.constant' import { ClientModule } from '../client/client.module' @@ -32,10 +33,13 @@ const INFRASTRUCTURE_MODULES = [ BullModule.registerQueue({ name: AUTHORIZATION_REQUEST_PROCESSING_QUEUE }), - BullBoardModule.forFeature({ - name: AUTHORIZATION_REQUEST_PROCESSING_QUEUE, - adapter: BullAdapter - }) + ConditionalModule.registerWhen( + BullBoardModule.forFeature({ + name: AUTHORIZATION_REQUEST_PROCESSING_QUEUE, + adapter: BullAdapter + }), + (env: NodeJS.ProcessEnv) => env.NODE_ENV === 'development' + ) ] const DOMAIN_MODULES = [ClientModule, TransferTrackingModule, PriceModule, DataFeedModule, PolicyEngineModule] diff --git a/apps/armory/src/shared/module/queue/queue.module.ts b/apps/armory/src/shared/module/queue/queue.module.ts index 01344f0ba..579699397 100644 --- a/apps/armory/src/shared/module/queue/queue.module.ts +++ b/apps/armory/src/shared/module/queue/queue.module.ts @@ -3,7 +3,8 @@ import { BullBoardModule } from '@bull-board/nestjs' import { ConfigService } from '@narval/config-module' import { BullModule } from '@nestjs/bull' import { DynamicModule } from '@nestjs/common' -import { Config, Env } from '../../../armory.config' +import { ConditionalModule, ConfigModule } from '@nestjs/config' +import { Config, Env, load } from '../../../armory.config' import { QUEUE_PREFIX } from '../../../armory.constant' export type RegisterQueueOption = { @@ -17,6 +18,7 @@ export class QueueModule { return { module: QueueModule, imports: [ + ConfigModule.forRoot({ load: [load] }), BullModule.forRootAsync({ inject: [ConfigService], useFactory: async (configService: ConfigService) => { @@ -28,10 +30,13 @@ export class QueueModule { } } }), - BullBoardModule.forRoot({ - route: '/admin/queues', - adapter: ExpressAdapter - }) + ConditionalModule.registerWhen( + BullBoardModule.forRoot({ + route: '/admin/queues', + adapter: ExpressAdapter + }), + (env: NodeJS.ProcessEnv) => env.NODE_ENV === 'development' + ) ] } }