fix(security): enforce secure-by-default Swagger UI disabling
Deploy Canina / deploy (push) Failing after 12s
Deploy Canina / deploy (push) Failing after 12s
This commit is contained in:
1 parent
6935ac9134
commit
5a483e0cce
2 files changed
+4
-4
No files matched your search
+3
-4
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user