openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
34 lines (33 loc) • 1.05 kB
JavaScript
import { l as normalizeOptionalString } from "./string-coerce-CCIiB4H7.mjs";
//#region src/shared/gateway-bind-url.ts
/** Resolves the externally advertised gateway URL for non-loopback bind modes. */
function resolveGatewayBindUrl(e) {
const t = e.bind ?? "loopback";
if (t === "custom") {
const t = normalizeOptionalString(e.customBindHost);
if (t) return {
url: `${e.scheme}://${t}:${e.port}`,
source: "gateway.bind=custom"
};
return { error: "gateway.bind=custom requires gateway.customBindHost." };
}
if (t === "tailnet") {
const t = e.pickTailnetHost();
if (t) return {
url: `${e.scheme}://${t}:${e.port}`,
source: "gateway.bind=tailnet"
};
return { error: "gateway.bind=tailnet set, but no tailnet IP was found." };
}
if (t === "lan") {
const t = e.pickLanHost();
if (t) return {
url: `${e.scheme}://${t}:${e.port}`,
source: "gateway.bind=lan"
};
return { error: "gateway.bind=lan set, but no private LAN IP was found." };
}
return null;
}
//#endregion
export { resolveGatewayBindUrl as t };