set mongo security

This commit is contained in:
2025-02-04 11:17:01 +05:30
parent bfd66ffb22
commit 927da93e60
3 changed files with 40 additions and 1 deletions

View File

@@ -1,20 +1,25 @@
import app from './app';
import http from 'http';
import ip from 'ip';
// import { startHealthCheck } from './controller/user-Controller';
import swaggerUi from 'swagger-ui-express';
import mongoAdminCreation from '../shared/security/mongosecurity';
const server = http.createServer(app);
let swaggerDocument;
try {
swaggerDocument = require('../../swagger-output.json');
} catch (error) {
console.error('Error loading Swagger JSON:', error);
swaggerDocument = {}; // Fallback: empty object or some default
}
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
const organization = process.env.ORGANIZATION_NAME || 'defaultOrganization'; // Replace with your logic
mongoAdminCreation()
if (!organization) {
throw new Error('ORGANIZATION_NAME is not defined in the environment');
}