Skip to content

Commit 8321876

Browse files
committed
fix: 兼容@nestjs/jwt@11.0.1版本
1 parent 7709a0b commit 8321876

File tree

2 files changed

+3993
-4895
lines changed

2 files changed

+3993
-4895
lines changed

apps/server/src/modules/web/auth/auth.module.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { ConfigModule, ConfigService } from "@nestjs/config";
1515
import { DiscoveryModule } from "@nestjs/core";
1616
import { JwtModule } from "@nestjs/jwt";
1717
import { TypeOrmModule } from "@nestjs/typeorm";
18+
import type { StringValue } from "ms";
1819

1920
import { AuthController } from "./auth.controller";
2021

@@ -47,11 +48,11 @@ import { AuthController } from "./auth.controller";
4748
JwtModule.registerAsync({
4849
imports: [ConfigModule],
4950
inject: [ConfigService],
50-
useFactory: (configService: ConfigService) => ({
51+
useFactory: () => ({
5152
// 从环境变量获取JWT密钥,如果不存在则使用默认值
5253
secret: process.env.JWT_SECRET || "BuildingAI",
5354
signOptions: {
54-
expiresIn: process.env.JWT_EXPIRES_IN || "24h",
55+
expiresIn: (process.env.JWT_EXPIRES_IN as StringValue) || "24h",
5556
},
5657
}),
5758
}),

0 commit comments

Comments
 (0)