diff --git a/docsfera.external.json b/docsfera.external.json index 1fdca24..4804bf0 100644 --- a/docsfera.external.json +++ b/docsfera.external.json @@ -1669,7 +1669,20 @@ "contact": {} }, "tags": [], - "servers": [], + "servers": [ + { + "url": "https://maestro.stg.dadosfera.ai", + "description": "Ambiente STG" + }, + { + "url": "https://maestro-2.stg.dadosfera.ai", + "description": "Ambiente STG2" + }, + { + "url": "https://maestro.dadosfera.ai", + "description": "Ambiente PRD" + } + ], "components": { "securitySchemes": { "access-token": { diff --git a/src/main.ts b/src/main.ts index 12d4b73..f5872cc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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,21 +24,8 @@ 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); } @@ -63,14 +50,18 @@ function configureSwagger(app: INestApplication) { in: 'header', }) .setDescription('This is the Maestro API') + .addServer('https://maestro.stg.dadosfera.ai', 'Ambiente STG') + .addServer('https://maestro-2.stg.dadosfera.ai', 'Ambiente STG2') + .addServer('https://maestro.dadosfera.ai', 'Ambiente PRD') .build(); const document = SwaggerModule.createDocument(app, config); - let swaggerJsonFile = 'docsfera.external.json'; - if (process.env.INTERNAL_SWAGGER === 'true') { - swaggerJsonFile = 'docsfera.json'; - } + const swaggerJsonFile = + process.env.INTERNAL_SWAGGER === 'true' + ? 'docsfera.json' + : 'docsfera.external.json'; + if (process.env.ENV === 'local') SwaggerModule.setup('api', app, document); writeFileSync(