From 0420b0acab4f61045b8785bde11d0fbb030ad7ff Mon Sep 17 00:00:00 2001 From: hailin Date: Thu, 15 Jan 2026 06:57:57 -0800 Subject: [PATCH] fix(trading,auth): add parent .env path for shared JWT_SECRET Both services need to read JWT_SECRET from the shared .env file in the parent directory (backend/services/.env). Co-Authored-By: Claude Opus 4.5 --- backend/services/auth-service/src/app.module.ts | 2 +- backend/services/trading-service/src/app.module.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/services/auth-service/src/app.module.ts b/backend/services/auth-service/src/app.module.ts index 221af990..3f90feba 100644 --- a/backend/services/auth-service/src/app.module.ts +++ b/backend/services/auth-service/src/app.module.ts @@ -9,7 +9,7 @@ import { InfrastructureModule } from './infrastructure/infrastructure.module'; // 配置模块 ConfigModule.forRoot({ isGlobal: true, - envFilePath: ['.env.local', '.env'], + envFilePath: ['.env.local', '.env', '../.env'], }), // 限流模块 diff --git a/backend/services/trading-service/src/app.module.ts b/backend/services/trading-service/src/app.module.ts index 58107000..7fc804de 100644 --- a/backend/services/trading-service/src/app.module.ts +++ b/backend/services/trading-service/src/app.module.ts @@ -13,7 +13,11 @@ import { JwtAuthGuard } from './shared/guards/jwt-auth.guard'; imports: [ ConfigModule.forRoot({ isGlobal: true, - envFilePath: [`.env.${process.env.NODE_ENV || 'development'}`, '.env'], + envFilePath: [ + `.env.${process.env.NODE_ENV || 'development'}`, + '.env', + '../.env', // 父目录共享 .env + ], ignoreEnvFile: false, }), InfrastructureModule,