Forráskód Böngészése

feat: update environment configuration for RabbitMQ and application settings

Dave 1 hónapja
szülő
commit
e7b45dd813

+ 21 - 14
.env

@@ -29,26 +29,33 @@ REDIS_KEY_PREFIX=
 
 # RabbitMQ Config: RABBITMQ_URL="amqp://boxrabbit:BoxRabbit2025@localhost:5672"
 # RabbitMQ Config
-RABBITMQ_URL="amqp://boxrabbit:BoxRabbit2025@127.0.0.1:5672"
-RABBITMQ_LOGIN_EXCHANGE="stats.user"
-RABBITMQ_LOGIN_QUEUE="stats.user.login.q"
-RABBITMQ_LOGIN_ROUTING_KEY="user.login"
-RABBITMQ_ADS_CLICK_ROUTING_KEY="stats.ad.click"
+RABBITMQ_URL=amqp://boxrabbit:BoxRabbit%232025@localhost:5672/
+RABBITMQ_LOGIN_EXCHANGE=stats.user
+RABBITMQ_LOGIN_QUEUE=stats.user.login.q
+RABBITMQ_LOGIN_ROUTING_KEY="user.login
+RABBITMQ_ADS_CLICK_ROUTING_KEY=stats.ad.click
 # Stats Events Queues & Routing Keys
-RABBITMQ_STATS_EXCHANGE="stats.user"
-RABBITMQ_STATS_AD_CLICK_QUEUE="stats.ad.click"
-RABBITMQ_STATS_AD_CLICK_ROUTING_KEY="stats.ad.click"
-RABBITMQ_STATS_VIDEO_CLICK_QUEUE="stats.video.click"
-RABBITMQ_STATS_VIDEO_CLICK_ROUTING_KEY="stats.video.click"
-RABBITMQ_STATS_AD_IMPRESSION_QUEUE="stats.ad.impression"
-RABBITMQ_STATS_AD_IMPRESSION_ROUTING_KEY="stats.ad.impression"
-
+RABBITMQ_STATS_EXCHANGE=stats.user
+RABBITMQ_STATS_AD_CLICK_QUEUE=stats.ad.click
+RABBITMQ_STATS_AD_CLICK_ROUTING_KEY=stats.ad.click
+RABBITMQ_STATS_VIDEO_CLICK_QUEUE=stats.video.click
+RABBITMQ_STATS_VIDEO_CLICK_ROUTING_KEY=stats.video.click
+RABBITMQ_STATS_AD_IMPRESSION_QUEUE=stats.ad.impression
+RABBITMQ_STATS_AD_IMPRESSION_ROUTING_KEY=stats.ad.impression
 
 # App set to 0.0.0.0 for local LAN access
+MGNT_HOST=0.0.0.0
+MGNT_PORT=3300
+MGNT_CORS_ORIGIN=*
+
 APP_HOST=0.0.0.0
-APP_PORT=3300
+APP_PORT=3301
 APP_CORS_ORIGIN=*
 
+STATS_PORT=3302
+STATS_HOST=0.0.0.0
+STATS_CORS_ORIGIN=*
+
 # 2FA config
 # node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
 TWOFA_ENC_KEY=2q89JPacSKDmuU3hJCfKQhDg3sq74QScy0ShYBoQPgM=

+ 9 - 1
.env.test

@@ -31,10 +31,18 @@ RABBITMQ_STATS_AD_IMPRESSION_ROUTING_KEY=stats.ad.impression
 
 
 # App set to 0.0.0.0 for local LAN access
+MGNT_HOST=0.0.0.0
+MGNT_PORT=3300
+MGNT_CORS_ORIGIN=*
+
 APP_HOST=0.0.0.0
-APP_PORT=3300
+APP_PORT=3301
 APP_CORS_ORIGIN=*
 
+STATS_PORT=3302
+STATS_HOST=0.0.0.0
+STATS_CORS_ORIGIN=*
+
 # 2FA config
 # node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
 TWOFA_ENC_KEY=2q89JPacSKDmuU3hJCfKQhDg3sq74QScy0ShYBoQPgM=

+ 2 - 1
apps/box-app-api/src/main.ts

@@ -25,7 +25,8 @@ async function bootstrap() {
     '0.0.0.0';
 
   const port =
-    configService.get<number>('APP_PORT') ?? Number(process.env.PORT ?? 3301);
+    configService.get<number>('APP_PORT') ??
+    Number(process.env.APP_PORT ?? 3301);
 
   const corsOrigin = configService.get<string>('APP_CORS_ORIGIN') ?? '*';
   const corsOriginOption =

+ 3 - 3
apps/box-mgnt-api/src/app.config.ts

@@ -1,9 +1,9 @@
 import { ConfigType, registerAs } from '@nestjs/config';
 
 export const appConfigFactory = registerAs('app', () => ({
-  port: process.env.APP_PORT,
-  host: process.env.APP_HOST,
-  crossOrigin: process.env.APP_CORS_ORIGIN,
+  port: process.env.MGNT_PORT,
+  host: process.env.MGNT_HOST,
+  crossOrigin: process.env.MGNT_CORS_ORIGIN,
 }));
 
 export type IAppConfig = ConfigType<typeof appConfigFactory>;

+ 4 - 4
apps/box-mgnt-api/src/main.ts

@@ -76,14 +76,14 @@ async function bootstrap() {
   const configService = app.get(ConfigService);
 
   const host =
-    configService.get<string>('APP_HOST') ??
-    configService.get<string>('HOST') ??
+    configService.get<string>('MGNT_HOST') ??
+    configService.get<string>('MGNT_HOST') ??
     '0.0.0.0';
 
   const port =
-    configService.get<number>('APP_PORT') ?? Number(process.env.PORT ?? 3300);
+    configService.get<number>('MGNT_PORT') ?? Number(process.env.PORT ?? 3300);
 
-  const corsOrigin = configService.get<string>('APP_CORS_ORIGIN') ?? '*';
+  const corsOrigin = configService.get<string>('MGNT_CORS_ORIGIN') ?? '*';
   const corsOriginOption =
     corsOrigin === '*'
       ? true

+ 4 - 3
apps/box-stats-api/src/main.ts

@@ -16,14 +16,15 @@ async function bootstrap() {
   const configService = app.get(ConfigService);
 
   const host =
-    configService.get<string>('APP_HOST') ??
+    configService.get<string>('STATS_HOST') ??
     configService.get<string>('HOST') ??
     '0.0.0.0';
 
   const port =
-    configService.get<number>('APP_PORT') ?? Number(process.env.PORT ?? 3302);
+    configService.get<number>('STATS_PORT') ??
+    Number(process.env.STATS_PORT ?? 3302);
 
-  const corsOrigin = configService.get<string>('APP_CORS_ORIGIN') ?? '*';
+  const corsOrigin = configService.get<string>('STATS_CORS_ORIGIN') ?? '*';
   const corsOriginOption =
     corsOrigin === '*'
       ? true