mirror of
https://github.com/dadosfera/maestro.git
synced 2026-12-04 13:50:05 +00:00
FIX: hide internal endpoints
This commit is contained in:
+18
-2
@@ -14,7 +14,7 @@ async function bootstrap() {
|
||||
serviceEnvironment: process.env.ENV,
|
||||
});
|
||||
const logger = new DadosferaLogger();
|
||||
|
||||
process.env.INTERNAL_SWAGGER = 'true';
|
||||
const app = await NestFactory.create(AppModule, {
|
||||
logger,
|
||||
cors: {
|
||||
@@ -24,9 +24,20 @@ async function bootstrap() {
|
||||
optionsSuccessStatus: 204,
|
||||
},
|
||||
});
|
||||
process.env.INTERNAL_SWAGGER = 'true';
|
||||
const app2 = await NestFactory.create(AppModule, {
|
||||
logger,
|
||||
cors: {
|
||||
origin: '*',
|
||||
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
||||
preflightContinue: false,
|
||||
optionsSuccessStatus: 204,
|
||||
},
|
||||
});
|
||||
|
||||
app.use(helmet());
|
||||
configureSwagger(app);
|
||||
// configureSwagger(app2);
|
||||
|
||||
await app.listen(3333);
|
||||
}
|
||||
@@ -56,9 +67,14 @@ function configureSwagger(app: INestApplication) {
|
||||
|
||||
const document = SwaggerModule.createDocument(app, config);
|
||||
|
||||
let swaggerJsonFile = 'docsfera.external.json';
|
||||
if (process.env.INTERNAL_SWAGGER === 'true') {
|
||||
swaggerJsonFile = 'docsfera.json';
|
||||
}
|
||||
if (process.env.ENV === 'local') SwaggerModule.setup('api', app, document);
|
||||
|
||||
writeFileSync(
|
||||
'docsfera.json',
|
||||
swaggerJsonFile,
|
||||
JSON.stringify(
|
||||
{
|
||||
service: '${DOCS_API_TOKEN}',
|
||||
|
||||
Reference in New Issue
Block a user