feat(security/devops): disable swagger in prod, secure staging with basic auth & noindex, add DB backup script and uploads volume persistence
Deploy Canina / deploy (push) Failing after 29s
Deploy Canina / deploy (push) Failing after 29s
This commit is contained in:
1 parent
9f11d8fb2d
commit
e281ef75da
5 files changed
+91
-10
No files matched your search
+18
-10
@@ -83,17 +83,25 @@ async function bootstrap() {
|
||||
|
||||
app.useGlobalInterceptors(new DecimalInterceptor());
|
||||
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle('Canina Iran API')
|
||||
.setDescription(
|
||||
'API Documentation for Canina Iran Pet Health & Supplement Platform',
|
||||
)
|
||||
.setVersion('1.0.0')
|
||||
.addBearerAuth()
|
||||
.build();
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
const enableSwagger = process.env.ENABLE_SWAGGER === 'true';
|
||||
|
||||
const document = SwaggerModule.createDocument(app, config);
|
||||
SwaggerModule.setup('api/docs', app, document);
|
||||
if (!isProduction || enableSwagger) {
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle('Canina Iran API')
|
||||
.setDescription(
|
||||
'API Documentation for Canina Iran Pet Health & Supplement Platform',
|
||||
)
|
||||
.setVersion('1.0.0')
|
||||
.addBearerAuth()
|
||||
.build();
|
||||
|
||||
const document = SwaggerModule.createDocument(app, config);
|
||||
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)');
|
||||
}
|
||||
|
||||
await app.listen(process.env.PORT ?? 4001);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user