Merge branch 'main' into feat/rest-api

This commit is contained in:
Gabriel Rosa
2022-11-09 15:03:09 -03:00
7 changed files with 126 additions and 21 deletions
+12 -7
View File
@@ -7,6 +7,7 @@ import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
import { AppModule } from './app.module';
import { writeFileSync } from 'fs';
import { execSync } from 'child_process';
import { INestApplication } from '@nestjs/common';
async function bootstrap() {
DadosferaLogger.setupLogger({
serviceName: 'maestro',
@@ -25,23 +26,29 @@ async function bootstrap() {
});
app.use(helmet());
configureSwagger(app);
await app.listen(3333);
}
function configureSwagger(app: INestApplication) {
const date = new Date();
let swaggerVersion = `${date.getDate()}.${
const swaggerVersion = `${date.getDate()}.${
date.getMonth() + 1
}.${date.getFullYear()} - ${date.getHours()}:${date.getMinutes()}`;
let branchName = '';
try {
const branchName = execSync('git rev-parse --abbrev-ref HEAD')
branchName = execSync('git rev-parse --abbrev-ref HEAD')
.toString()
.replace('\n', '');
swaggerVersion = branchName;
.replace('\n', '')
.trim();
} catch (error) {
console.log("Can't get branch name", error);
}
const swaggerTitle = branchName ? `Maestro - ${branchName}` : 'Maestro';
const config = new DocumentBuilder()
.setTitle('Maestro')
.setTitle(swaggerTitle)
.setDescription('Documentation for Maestro gateway')
.setVersion(swaggerVersion)
.addBearerAuth(
@@ -66,7 +73,5 @@ async function bootstrap() {
2,
),
);
await app.listen(3333);
}
bootstrap();