Files
openclaw/src/gateway/probe-target.ts
2026-04-06 12:24:32 +01:00

20 lines
686 B
TypeScript

import type { OpenClawConfig } from "../config/config.js";
export type GatewayProbeTargetResolution = {
gatewayMode: "local" | "remote";
mode: "local" | "remote";
remoteUrlMissing: boolean;
};
export function resolveGatewayProbeTarget(cfg: OpenClawConfig): GatewayProbeTargetResolution {
const gatewayMode = cfg.gateway?.mode === "remote" ? "remote" : "local";
const remoteUrlRaw =
typeof cfg.gateway?.remote?.url === "string" ? cfg.gateway.remote.url.trim() : "";
const remoteUrlMissing = gatewayMode === "remote" && !remoteUrlRaw;
return {
gatewayMode,
mode: gatewayMode === "remote" && !remoteUrlMissing ? "remote" : "local",
remoteUrlMissing,
};
}