feat: 实现演示验证码和令牌轮换
This commit is contained in:
@@ -2,12 +2,20 @@ import "reflect-metadata";
|
||||
import { ValidationPipe, type INestApplication } from "@nestjs/common";
|
||||
import { NestFactory } from "@nestjs/core";
|
||||
import helmet from "helmet";
|
||||
import type { Application } from "express";
|
||||
import { AppModule } from "./app.module.js";
|
||||
import { validateAuthEnvironment } from "./auth/auth.config.js";
|
||||
import { HttpResponseInterceptor } from "./common/http-response.interceptor.js";
|
||||
import { DomainExceptionFilter } from "./common/domain-exception.filter.js";
|
||||
|
||||
export function configureApp(app: INestApplication): void {
|
||||
validateAuthEnvironment();
|
||||
const allowedOrigin = process.env.WEB_ORIGIN ?? "http://localhost:3000";
|
||||
const adapter = app.getHttpAdapter?.() as
|
||||
{ getInstance(): Application } | undefined;
|
||||
adapter
|
||||
?.getInstance()
|
||||
.set("trust proxy", process.env.TRUST_PROXY === "true" ? 1 : false);
|
||||
app.setGlobalPrefix("api/v1");
|
||||
app.use(helmet());
|
||||
app.useGlobalPipes(
|
||||
@@ -35,6 +43,7 @@ type AppFactory = () => Promise<INestApplication>;
|
||||
export async function bootstrap(
|
||||
appFactory: AppFactory = () => NestFactory.create(AppModule),
|
||||
): Promise<void> {
|
||||
validateAuthEnvironment();
|
||||
const app = await appFactory();
|
||||
configureApp(app);
|
||||
app.enableShutdownHooks();
|
||||
|
||||
Reference in New Issue
Block a user