mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-17 08:29:07 +00:00
Merge branch 'main' into feat/rest-api
This commit is contained in:
+12
-7
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user