diff --git a/backend/src/main.ts b/backend/src/main.ts index 9d2b66fd..c59b3b64 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -144,10 +144,9 @@ async function bootstrap() { app.useGlobalInterceptors(new DecimalInterceptor()); - const isProduction = process.env.NODE_ENV === "production"; - const isSwaggerExplicitlyDisabled = process.env.ENABLE_SWAGGER === "false"; + const isSwaggerEnabled = process.env.ENABLE_SWAGGER === "true"; - if (!isProduction && !isSwaggerExplicitlyDisabled) { + if (isSwaggerEnabled) { const config = new DocumentBuilder() .setTitle("Canina Iran API") .setDescription( @@ -161,7 +160,7 @@ async function bootstrap() { SwaggerModule.setup("api/docs", app, document); console.log("Swagger UI is ACTIVE on /api/docs"); } else { - console.log("Swagger UI is DISABLED for security (production environment)"); + console.log("Swagger UI is DISABLED for security"); } await app.listen(process.env.PORT ?? 4001); diff --git a/scripts/compose.stage.yml b/scripts/compose.stage.yml index a72e0dc5..f929e162 100644 --- a/scripts/compose.stage.yml +++ b/scripts/compose.stage.yml @@ -42,6 +42,7 @@ services: - REDIS_PORT=6379 - PORT=3000 - FRONTEND_URL=https://stage.canina.ir + - ENABLE_SWAGGER=false # Direct Next port avoids nginx /api forwarding back into this backend. - FRONTEND_INTERNAL_URL=http://frontend_stage:3000 # Code-only stage startup: schema/seed changes require separate authorization.