fix: render nc01 external postgres bridge

This commit is contained in:
root
2026-07-09 10:01:48 +02:00
parent b450cc8dc7
commit e257ca0a4f
3 changed files with 33 additions and 6 deletions
+9 -6
View File
@@ -5150,15 +5150,18 @@ function v02PostgresManifest({ profile = "v02", migrationSql, source, image = "p
};
}
function externalPostgresConfigForLane(deploy, profile) {
function externalPostgresConfigForLane(deploy, profile, args = {}) {
if (!isRuntimeLane(profile)) return null;
const config = deploy?.lanes?.[profile]?.externalPostgres;
if (!config || config.enabled !== true) return null;
assert.ok(typeof config.serviceName === "string" && config.serviceName.length > 0, `deploy.lanes.${profile}.externalPostgres.serviceName is required`);
assert.ok(typeof config.endpointAddress === "string" && config.endpointAddress.length > 0, `deploy.lanes.${profile}.externalPostgres.endpointAddress is required`);
const port = Number(config.port ?? 5432);
const nodeId = effectiveSecretPlaneNodeId(args);
const nodeConfig = nodeId ? config?.nodes?.[nodeId] : null;
const effective = nodeConfig && typeof nodeConfig === "object" && !Array.isArray(nodeConfig) ? { ...config, ...nodeConfig } : config;
assert.ok(typeof effective.serviceName === "string" && effective.serviceName.length > 0, `deploy.lanes.${profile}.externalPostgres.serviceName is required`);
assert.ok(typeof effective.endpointAddress === "string" && effective.endpointAddress.length > 0, `deploy.lanes.${profile}.externalPostgres.endpointAddress is required`);
const port = Number(effective.port ?? 5432);
assert.ok(Number.isInteger(port) && port > 0 && port <= 65535, `deploy.lanes.${profile}.externalPostgres.port must be a valid TCP port`);
return { serviceName: config.serviceName, endpointAddress: config.endpointAddress, port };
return { serviceName: effective.serviceName, endpointAddress: effective.endpointAddress, port };
}
function externalPostgresManifest({ profile = "v03", config, source }) {
@@ -5960,7 +5963,7 @@ async function plannedFiles(args) {
for (const profile of profiles) {
const namespace = namespaceNameForProfile(profile);
const includeDeviceAgent = profile === "dev";
const externalPostgres = externalPostgresConfigForLane(deploy, profile);
const externalPostgres = externalPostgresConfigForLane(deploy, profile, args);
const workbenchRedis = workbenchRuntimeRedisConfigForProfile(deploy, profile);
const runtimeConfigMaps = runtimeConfigMapsForProfile(deploy, profile);
const runtimeSecretPlane = await runtimeSecretPlaneConfigForProfile(deploy, profile, args);