env vars
This commit is contained in:
@@ -11,8 +11,11 @@ import { AuthenticationGuard } from './domain/auth/AuthenticationGuard';
|
||||
import { AuthorizationGuard } from './domain/auth/AuthorizationGuard';
|
||||
import { FeatureAvailabilityGuard } from './domain/policy/FeatureAvailabilityGuard';
|
||||
|
||||
import { getGenerateOpenapi } from './env';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule, process.env.GENERATE_OPENAPI ? { logger: false } : undefined);
|
||||
const generateOpenapi = getGenerateOpenapi();
|
||||
const app = await NestFactory.create(AppModule, generateOpenapi ? { logger: false } : undefined);
|
||||
|
||||
// Website runs on a different origin in dev/docker (e.g. http://localhost:3000 -> http://localhost:3001),
|
||||
// and our website HTTP client uses `credentials: 'include'`, so we must support CORS with credentials.
|
||||
@@ -64,7 +67,7 @@ async function bootstrap() {
|
||||
SwaggerModule.setup('api/docs', app as any, document);
|
||||
|
||||
// Export OpenAPI spec as JSON file when GENERATE_OPENAPI env var is set
|
||||
if (process.env.GENERATE_OPENAPI) {
|
||||
if (generateOpenapi) {
|
||||
const outputPath = join(__dirname, '../openapi.json');
|
||||
writeFileSync(outputPath, JSON.stringify(document, null, 2));
|
||||
console.log(`✅ OpenAPI spec generated at: ${outputPath}`);
|
||||
|
||||
Reference in New Issue
Block a user