mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 21:21:10 +00:00
20 lines
686 B
TypeScript
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,
|
|
};
|
|
}
|