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,9 +6,12 @@ import { ConfigService } from '@nestjs/config'; ...@@ -6,9 +6,12 @@ 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 config = app.get(ConfigService);
if (!config.get('NO_OPENAPI')) {
const documentConfig = new DocumentBuilder() const documentConfig = new DocumentBuilder()
.setTitle('app') .setTitle('app')
.setDescription('The app') .setDescription('The app')
...@@ -17,8 +20,8 @@ async function bootstrap() { ...@@ -17,8 +20,8 @@ async function bootstrap() {
const document = SwaggerModule.createDocument(app, documentConfig); const document = SwaggerModule.createDocument(app, documentConfig);
SwaggerModule.setup('docs', app, document); SwaggerModule.setup('docs', app, document);
}
const config = app.get(ConfigService);
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