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

fix: rename PORT to MGNT_PORT and update CORS origin environment variable

Dave 1 hónapja
szülő
commit
772349f95b

+ 1 - 1
apps/box-mgnt-api/src/config/env.validation.ts

@@ -46,7 +46,7 @@ class EnvironmentVariables {
   @Min(1024)
   @Max(65535)
   @IsOptional()
-  PORT: number = 3000;
+  MGNT_PORT: number = 3000;
 
   // ===== Redis Config =====
 

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

@@ -34,7 +34,7 @@ async function bootstrap() {
 
   // after creating fastifyAdapter but before NestFactory.create:
   // Read allowed origin from env (fallback to '*')
-  const corsOrg = process.env.APP_CORS_ORIGIN || '*';
+  const corsOrg = process.env.MGNT_CORS_ORIGIN || '*';
 
   // await fastifyAdapter.register(fastifyStatic as any, {
   //   root: path.resolve(process.env.IMAGE_ROOT_PATH || '/data/box-images'),
@@ -77,11 +77,12 @@ async function bootstrap() {
 
   const host =
     configService.get<string>('MGNT_HOST') ??
-    configService.get<string>('MGNT_HOST') ??
+    configService.get<string>('HOST') ??
     '0.0.0.0';
 
   const port =
-    configService.get<number>('MGNT_PORT') ?? Number(process.env.PORT ?? 3300);
+    configService.get<number>('MGNT_PORT') ??
+    Number(process.env.MGNT_PORT ?? 3300);
 
   const corsOrigin = configService.get<string>('MGNT_CORS_ORIGIN') ?? '*';
   const corsOriginOption =