mirror of
https://github.com/dadosfera/maestro.git
synced 2026-12-01 23:00:04 +00:00
Set branch name on swagger version
This commit is contained in:
+1
-1
@@ -3257,7 +3257,7 @@
|
||||
"info": {
|
||||
"title": "Maestro",
|
||||
"description": "Documentation for Maestro gateway",
|
||||
"version": "9.11.2022 - 11:27",
|
||||
"version": "feat/rest-api",
|
||||
"contact": {}
|
||||
},
|
||||
"tags": [],
|
||||
|
||||
+14
-5
@@ -6,6 +6,7 @@ import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
import { writeFile, writeFileSync } from 'fs';
|
||||
import { exec, ExecException, execSync } from 'child_process';
|
||||
async function bootstrap() {
|
||||
DadosferaLogger.setupLogger({
|
||||
serviceName: 'maestro',
|
||||
@@ -26,15 +27,23 @@ async function bootstrap() {
|
||||
app.use(helmet());
|
||||
|
||||
const date = new Date();
|
||||
let swaggerVersion = `${date.getDate()}.${
|
||||
date.getMonth() + 1
|
||||
}.${date.getFullYear()} - ${date.getHours()}:${date.getMinutes()}`;
|
||||
|
||||
try {
|
||||
const branchName = execSync('git rev-parse --abbrev-ref HEAD')
|
||||
.toString()
|
||||
.replace('\n', '');
|
||||
swaggerVersion = branchName;
|
||||
} catch (error) {
|
||||
console.log("Can't get branch name", error);
|
||||
}
|
||||
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle('Maestro')
|
||||
.setDescription('Documentation for Maestro gateway')
|
||||
.setVersion(
|
||||
`${date.getDate()}.${
|
||||
date.getMonth() + 1
|
||||
}.${date.getFullYear()} - ${date.getHours()}:${date.getMinutes()}`,
|
||||
)
|
||||
.setVersion(swaggerVersion)
|
||||
.addBearerAuth(
|
||||
{ type: 'http', scheme: 'bearer', bearerFormat: 'JWT' },
|
||||
'Authorization',
|
||||
|
||||
Reference in New Issue
Block a user