fix(workbench): bound runtime db pool from yaml (#1920)
This commit is contained in:
@@ -939,6 +939,8 @@ function deployServicesForProfile(deploy, profile) {
|
||||
copy.env,
|
||||
serviceDeclarationEnvForProfile(deploy, profile, service.serviceId),
|
||||
runtimeStoreEnvForProfile(deploy, profile, service.serviceId),
|
||||
workbenchRuntimeClientEnvForProfile(deploy, profile, service.serviceId),
|
||||
workbenchRuntimePostgresEnvForProfile(deploy, profile, service.serviceId),
|
||||
workbenchRuntimeRedisEnvForProfile(deploy, profile, service.serviceId)
|
||||
);
|
||||
return [service.serviceId, copy];
|
||||
@@ -952,6 +954,8 @@ function deployServicesForProfile(deploy, profile) {
|
||||
env: mergeEnvMaps(
|
||||
serviceDeclarationEnvForProfile(deploy, profile, override.serviceId),
|
||||
runtimeStoreEnvForProfile(deploy, profile, override.serviceId),
|
||||
workbenchRuntimeClientEnvForProfile(deploy, profile, override.serviceId),
|
||||
workbenchRuntimePostgresEnvForProfile(deploy, profile, override.serviceId),
|
||||
workbenchRuntimeRedisEnvForProfile(deploy, profile, override.serviceId)
|
||||
)
|
||||
};
|
||||
@@ -1049,6 +1053,26 @@ function workbenchRuntimeRedisEnvForProfile(deploy, profile, serviceId) {
|
||||
return env;
|
||||
}
|
||||
|
||||
function workbenchRuntimeClientEnvForProfile(deploy, profile, serviceId) {
|
||||
if (!isRuntimeLane(profile) || serviceId !== "hwlab-cloud-api") return {};
|
||||
const client = runtimeLaneConfig(deploy, profile)?.workbenchRuntime?.client;
|
||||
if (!client || typeof client !== "object" || Array.isArray(client)) return {};
|
||||
const env = {};
|
||||
if (Number.isInteger(client.timeoutMs)) env.HWLAB_WORKBENCH_RUNTIME_TIMEOUT_MS = String(client.timeoutMs);
|
||||
return env;
|
||||
}
|
||||
|
||||
function workbenchRuntimePostgresEnvForProfile(deploy, profile, serviceId) {
|
||||
if (!isRuntimeLane(profile) || serviceId !== "hwlab-workbench-runtime") return {};
|
||||
const postgres = runtimeLaneConfig(deploy, profile)?.workbenchRuntime?.postgres;
|
||||
if (!postgres || typeof postgres !== "object" || Array.isArray(postgres)) return {};
|
||||
const env = {};
|
||||
if (Number.isInteger(postgres.poolMax)) env.HWLAB_WORKBENCH_RUNTIME_DB_POOL_MAX = String(postgres.poolMax);
|
||||
if (Number.isInteger(postgres.queryTimeoutMs)) env.HWLAB_WORKBENCH_RUNTIME_QUERY_TIMEOUT_MS = String(postgres.queryTimeoutMs);
|
||||
if (Number.isInteger(postgres.readyTimeoutMs)) env.HWLAB_WORKBENCH_RUNTIME_READY_TIMEOUT_MS = String(postgres.readyTimeoutMs);
|
||||
return env;
|
||||
}
|
||||
|
||||
function workbenchRuntimeRedisConfigForProfile(deploy, profile) {
|
||||
if (!isRuntimeLane(profile)) return null;
|
||||
const label = `deploy.lanes.${profile}.workbenchRuntime.cache.redis`;
|
||||
|
||||
Reference in New Issue
Block a user