From 053e6224eed14829b6cb2fb5cbf8755f0616c74e Mon Sep 17 00:00:00 2001 From: lovefyf Date: Thu, 13 Aug 2026 02:44:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=88=E5=AE=A1=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E2=80=94=E2=80=94health=20=E6=96=AD=E8=A8=80=E7=B2=BE=E7=A1=AE?= =?UTF-8?q?=E5=8C=96=E3=80=81config=20=E6=B3=A8=E9=87=8A=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- src/shared/config.ts | 2 +- test/unit/health.test.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/shared/config.ts b/src/shared/config.ts index 1ff3648..9bab31a 100644 --- a/src/shared/config.ts +++ b/src/shared/config.ts @@ -5,7 +5,7 @@ export const config = { url: process.env.KEYCLOAK_URL ?? 'https://keycloak.akhr-ai.com', realm: process.env.KEYCLOAK_REALM ?? 'corp', clientId: process.env.KEYCLOAK_CLIENT_ID ?? 'api-gateway', - clientSecret: process.env.KEYCLOAK_CLIENT_SECRET, // 只从环境读,无缺省;data-service 恒无 + clientSecret: process.env.KEYCLOAK_CLIENT_SECRET, // 只从环境读,无缺省 }, agentServiceUrl: process.env.AGENT_SERVICE_URL ?? 'http://127.0.0.1:8901', taskServiceUrl: process.env.TASK_SERVICE_URL ?? 'http://127.0.0.1:8801', diff --git a/test/unit/health.test.ts b/test/unit/health.test.ts index 093daa1..bf87a28 100644 --- a/test/unit/health.test.ts +++ b/test/unit/health.test.ts @@ -6,6 +6,7 @@ vi.mock('../../src/shared/bus/nats', () => ({ })); import { buildApp } from '../../src/app/app'; +import { config } from '../../src/shared/config'; describe('health', () => { it('nats 探活 ok(mock)时返回 200', async () => { @@ -17,7 +18,9 @@ describe('health', () => { checks: Record; }; expect(body.ok).toBe(true); - expect(body.service).toMatch(/^bpos-service-/); + expect(body.service).toBe('bpos-service-gateway'); + expect(config.port).toBe(8800); + expect(config.keycloak.clientId).toBe('api-gateway'); expect(body.checks['nats']).toBe('ok'); }); });