fix: route HWPOD L1 through native node registry
This commit is contained in:
@@ -52,7 +52,7 @@ targets:
|
||||
- "F:\\Work\\ConStart"
|
||||
defaultRoot: "F:\\Work\\ConStart"
|
||||
desktopConfig:
|
||||
serverUrl: https://hwlab.pikapython.com
|
||||
serverUrl: https://lab-dev-hwpod.hwpod.com/hwpods/devices
|
||||
autoConnect: true
|
||||
requireCredential: true
|
||||
updateEnabled: true
|
||||
|
||||
@@ -218,10 +218,9 @@ lanes:
|
||||
autoCollapseTerminal: false
|
||||
hwpod:
|
||||
healthTimeoutMs: 6000
|
||||
runtimeApiUrl: https://lab-dev.hwpod.com
|
||||
runtimeApiAuth:
|
||||
sourceRef: hwlab/nc01-v03-admin.env
|
||||
sourceKey: HWLAB_API_KEY
|
||||
nodeAuth:
|
||||
sourceRef: hwlab/nc01-v03-hwpod-node.env
|
||||
sourceKey: HWLAB_HWPOD_NODE_WS_TOKEN
|
||||
specRegistry:
|
||||
database:
|
||||
sourceRef: hwlab/nc01-v03-cloud-api-db.env
|
||||
|
||||
@@ -67,8 +67,13 @@ test("L1 HWPOD spec registry resolves PostgreSQL authority and frozen built-ins
|
||||
connectionTimeoutMs: 5000,
|
||||
});
|
||||
expect(native!.healthTimeoutMs).toBe(6000);
|
||||
expect(native!.nodeAuth).toEqual({ sourceRef: "hwlab/nc01-v03-hwpod-node.env", sourceKey: "HWLAB_HWPOD_NODE_WS_TOKEN" });
|
||||
expect(native!.web.accessProfile).toEqual({ id: "hwpod-native-l1", allowedNavIds: ["admin.hwpodGroups"], startPath: "/hwpods/devices" });
|
||||
const env = hwlabHwpodNativeDevelopmentEnvironment(native!);
|
||||
expect(env.HWPOD_NODE_WS_TOKEN).toBeTruthy();
|
||||
expect(env.HWPOD_NODE_OPS_API_URL).toBe("http://127.0.0.1:6681");
|
||||
expect(env.HWPOD_RUNTIME_API_URL).toBeUndefined();
|
||||
expect(env.HWPOD_RUNTIME_API_AUTHORIZATION).toBeUndefined();
|
||||
expect(JSON.parse(env.HWPOD_WEB_RUNTIME_CONFIG!)).toEqual(native!.web.runtimeConfig);
|
||||
expect(native!.web.runtimeConfig).toEqual(hwlabRuntimeLaneSpecForNode("v03", "NC01").nativeDevelopment!.workbench.web.runtimeConfig);
|
||||
expect(JSON.parse(env.HWPOD_WEB_ACCESS_PROFILE_JSON!)).toEqual(native!.web.accessProfile);
|
||||
|
||||
@@ -301,11 +301,11 @@ function hwlabCaseRunNativeDevelopmentEnvironment(native: NonNullable<HwlabRunti
|
||||
}
|
||||
|
||||
export function hwlabHwpodNativeDevelopmentEnvironment(native: NonNullable<HwlabRuntimeNativeDevelopmentSpec["hwpod"]>): NodeJS.ProcessEnv {
|
||||
const authorizationSource = readEnvSourceFile({
|
||||
const nodeAuthSource = readEnvSourceFile({
|
||||
root: "/root/.unidesk/.state/secrets",
|
||||
sourceRef: native.runtimeApiAuth.sourceRef,
|
||||
sourceRef: native.nodeAuth.sourceRef,
|
||||
});
|
||||
const runtimeApiKey = requiredEnvValue(authorizationSource.values, native.runtimeApiAuth.sourceKey, native.runtimeApiAuth.sourceRef);
|
||||
const nodeToken = requiredEnvValue(nodeAuthSource.values, native.nodeAuth.sourceKey, native.nodeAuth.sourceRef);
|
||||
const databaseSource = readEnvSourceFile({
|
||||
root: "/root/.unidesk/.state/secrets",
|
||||
sourceRef: native.specRegistry.database.sourceRef,
|
||||
@@ -326,8 +326,7 @@ export function hwlabHwpodNativeDevelopmentEnvironment(native: NonNullable<Hwlab
|
||||
HWPOD_ACTIVITY_RETRY_INITIAL_INTERVAL_MS: String(native.temporal.activity.retryInitialIntervalMs),
|
||||
HWPOD_ACTIVITY_RETRY_MAXIMUM_INTERVAL_MS: String(native.temporal.activity.retryMaximumIntervalMs),
|
||||
HWPOD_ACTIVITY_RETRY_MAXIMUM_ATTEMPTS: String(native.temporal.activity.retryMaximumAttempts),
|
||||
HWPOD_RUNTIME_API_URL: native.runtimeApiUrl,
|
||||
HWPOD_RUNTIME_API_AUTHORIZATION: `Bearer ${runtimeApiKey}`,
|
||||
HWPOD_NODE_WS_TOKEN: nodeToken,
|
||||
HWPOD_SPEC_DATABASE_URL: databaseUrl,
|
||||
HWPOD_SPEC_DATABASE_SCHEMA: native.specRegistry.database.schema,
|
||||
HWPOD_SPEC_DATABASE_TABLE: native.specRegistry.database.table,
|
||||
@@ -345,5 +344,6 @@ export function hwlabHwpodNativeDevelopmentEnvironment(native: NonNullable<Hwlab
|
||||
HWPOD_WEB_RUNTIME_CONFIG: JSON.stringify(native.web.runtimeConfig),
|
||||
HWPOD_WEB_ACCESS_PROFILE_JSON: JSON.stringify(native.web.accessProfile),
|
||||
HWPOD_NATIVE_API_URL: `http://${native.api.probeHost}:${native.api.port}`,
|
||||
HWPOD_NODE_OPS_API_URL: `http://${native.api.probeHost}:${native.api.port}`,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -764,8 +764,7 @@ export interface HwlabRuntimeNativeDevelopmentSpec {
|
||||
readonly publicExposure: HwlabRuntimeNativePublicExposureSpec;
|
||||
readonly stateDir: string;
|
||||
readonly healthTimeoutMs: number;
|
||||
readonly runtimeApiUrl: string;
|
||||
readonly runtimeApiAuth: { readonly sourceRef: string; readonly sourceKey: string };
|
||||
readonly nodeAuth: { readonly sourceRef: string; readonly sourceKey: string };
|
||||
readonly specRegistry: {
|
||||
readonly database: {
|
||||
readonly sourceRef: string;
|
||||
@@ -1700,7 +1699,7 @@ function nativeDevelopmentConfig(value: unknown, path: string): HwlabRuntimeNati
|
||||
|
||||
function nativeHwpodConfig(value: unknown, path: string): NonNullable<HwlabRuntimeNativeDevelopmentSpec["hwpod"]> {
|
||||
const raw = asRecord(value, path);
|
||||
const runtimeApiAuth = asRecord(raw.runtimeApiAuth, `${path}.runtimeApiAuth`);
|
||||
const nodeAuth = asRecord(raw.nodeAuth, `${path}.nodeAuth`);
|
||||
const specRegistry = asRecord(raw.specRegistry, `${path}.specRegistry`);
|
||||
const database = asRecord(specRegistry.database, `${path}.specRegistry.database`);
|
||||
const temporal = asRecord(raw.temporal, `${path}.temporal`);
|
||||
@@ -1717,10 +1716,9 @@ function nativeHwpodConfig(value: unknown, path: string): NonNullable<HwlabRunti
|
||||
publicExposure: nativePublicExposureConfig(raw.publicExposure, `${path}.publicExposure`),
|
||||
stateDir: relativeWorkspacePathField(stringField(raw, "stateDir", path), `${path}.stateDir`),
|
||||
healthTimeoutMs: numberField(raw, "healthTimeoutMs", path),
|
||||
runtimeApiUrl: httpUrlField(raw, "runtimeApiUrl", path),
|
||||
runtimeApiAuth: {
|
||||
sourceRef: stringField(runtimeApiAuth, "sourceRef", `${path}.runtimeApiAuth`),
|
||||
sourceKey: stringField(runtimeApiAuth, "sourceKey", `${path}.runtimeApiAuth`),
|
||||
nodeAuth: {
|
||||
sourceRef: stringField(nodeAuth, "sourceRef", `${path}.nodeAuth`),
|
||||
sourceKey: stringField(nodeAuth, "sourceKey", `${path}.nodeAuth`),
|
||||
},
|
||||
specRegistry: {
|
||||
database: {
|
||||
|
||||
Reference in New Issue
Block a user