Commit 9b41a9a7 authored by nanahira's avatar nanahira

add NO_OPENAPI

parent 3e4f2db4
Pipeline #22079 passed with stages
in 1 minute and 52 seconds
...@@ -6,19 +6,22 @@ import { ConfigService } from '@nestjs/config'; ...@@ -6,19 +6,22 @@ import { ConfigService } from '@nestjs/config';
async function bootstrap() { async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(AppModule); const app = await NestFactory.create<NestExpressApplication>(AppModule);
app.setGlobalPrefix('api/v2');
app.enableCors(); app.enableCors();
app.set('trust proxy', ['172.16.0.0/12', 'loopback']); app.set('trust proxy', ['172.16.0.0/12', 'loopback']);
const documentConfig = new DocumentBuilder()
.setTitle('app')
.setDescription('The app')
.setVersion('1.0')
.build();
const document = SwaggerModule.createDocument(app, documentConfig);
SwaggerModule.setup('docs', app, document);
const config = app.get(ConfigService); const config = app.get(ConfigService);
if (!config.get('NO_OPENAPI')) {
const documentConfig = new DocumentBuilder()
.setTitle('app')
.setDescription('The app')
.setVersion('1.0')
.build();
const document = SwaggerModule.createDocument(app, documentConfig);
SwaggerModule.setup('docs', app, document);
}
await app.listen( await app.listen(
config.get<number>('port') || 3000, config.get<number>('port') || 3000,
config.get<string>('host') || '::', config.get<string>('host') || '::',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment