mirror of
https://github.com/dadosfera/maestro.git
synced 2026-08-31 19:58:21 +00:00
FIX: add multiple servers
This commit is contained in:
+14
-1
@@ -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": {
|
||||
|
||||
+9
-18
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user