Only enable CORS on production

This commit is contained in:
Toast 2025-01-30 10:23:04 +01:00
parent c25a6be9f4
commit 43898b3b95

View file

@ -1,12 +1,20 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { Logger } from '@nestjs/common';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
if (process.env.NODE_ENV == 'production') {
app.enableCors({
credentials: true,
origin: ['https://shows.everest.tailscale/admin/']
origin: ['https://shows.everest.tailscale/admin/'],
});
} else {
const logger = new Logger("bootstrap")
logger.log("In development mode, not enabling CORS")
}
await app.listen(process.env.PORT ?? 3000);
}
bootstrap();