From 4b39be59970f023e920022224e5dbe65675f8e82 Mon Sep 17 00:00:00 2001 From: hided62 Date: Sat, 22 Aug 2026 15:50:53 +0000 Subject: [PATCH] =?UTF-8?q?fix(gateway):=20=ED=94=84=EB=A1=9C=ED=95=84=20D?= =?UTF-8?q?B=20URL=20=EC=9D=B8=EC=BD=94=EB=94=A9=EC=9D=84=20=EB=B3=B4?= =?UTF-8?q?=EC=A1=B4=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gateway orchestrator의 profile migration과 runtime이 GATEWAY_DATABASE_URL에서 schema만 바꾸도록 통일한다. 특수문자 비밀번호를 raw POSTGRES 값으로 재조합하지 않는 DEPLOY 회귀 테스트를 추가한다. --- .../src/orchestrator/gatewayOrchestrator.ts | 11 ++++++----- app/gateway-api/test/profileDeployOperation.test.ts | 13 ++++++++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/gateway-api/src/orchestrator/gatewayOrchestrator.ts b/app/gateway-api/src/orchestrator/gatewayOrchestrator.ts index 668acf82..102e74ca 100644 --- a/app/gateway-api/src/orchestrator/gatewayOrchestrator.ts +++ b/app/gateway-api/src/orchestrator/gatewayOrchestrator.ts @@ -17,12 +17,13 @@ import { gatewayProfileCapabilities } from '@sammo-ts/common'; import { createGamePostgresConnector, createRedisConnector, - resolvePostgresConfigFromEnv, resolvePostgresPoolMax, resolveRedisConfigFromEnv, } from '@sammo-ts/infra'; import { isRecord } from '@sammo-ts/common'; +import { resolveGatewayPostgresConfigFromEnv } from '../gatewayPostgresConfig.js'; + import { buildTurboReleaseCommand, buildTurboReleaseTaskCommand, @@ -2249,10 +2250,10 @@ export class GatewayOrchestrator implements GatewayOrchestratorHandle { } private resolveProfileDatabaseUrl(profile: GatewayProfileRecord): string { - return resolvePostgresConfigFromEnv({ - env: this.processConfig.baseEnv ?? process.env, - schema: profile.profile, - }).url; + return resolveGatewayPostgresConfigFromEnv( + this.processConfig.baseEnv ?? process.env, + profile.profile + ).url; } private async clearTournamentRuntimeStateFromRedis(profileName: string): Promise { diff --git a/app/gateway-api/test/profileDeployOperation.test.ts b/app/gateway-api/test/profileDeployOperation.test.ts index 0998f2f5..67154d05 100644 --- a/app/gateway-api/test/profileDeployOperation.test.ts +++ b/app/gateway-api/test/profileDeployOperation.test.ts @@ -186,7 +186,15 @@ describe('profile DEPLOY operation', () => { frontendServeMode: 'static', frontendArtifactRoot: path.join(workspace, 'artifact-volume'), frontendReadinessOrigin: 'http://caddy', - baseEnv: { DATABASE_URL: 'postgresql://user:pass@integration.invalid/sammo' }, + baseEnv: { + GATEWAY_DATABASE_URL: + 'postgresql://user:encoded%23password@integration.invalid/sammo?schema=public', + POSTGRES_USER: 'user', + POSTGRES_PASSWORD: 'raw#password', + POSTGRES_HOST: 'integration.invalid', + POSTGRES_PORT: '5432', + POSTGRES_DB: 'sammo', + }, }, reconcileIntervalMs: 60_000, scheduleIntervalMs: 60_000, @@ -214,6 +222,9 @@ describe('profile DEPLOY operation', () => { expect(commandGroups[1]?.map((command) => command.args)).toEqual([ ['--filter', '@sammo-ts/infra', 'prisma:migrate:deploy:game'], ]); + expect(commandGroups[1]?.[0]?.env?.DATABASE_URL).toBe( + 'postgresql://user:encoded%23password@integration.invalid/sammo?schema=che' + ); expect(commandGroups.flat().some((command) => command.env?.GATEWAY_ROLE === 'profile-seed')).toBe(false); expect(patches.at(-1)).toMatchObject({ buildStatus: 'SUCCEEDED',