openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
17 lines (16 loc) • 786 B
JavaScript
import { D as parseStrictPositiveInteger } from "./number-coercion-D6u-4YD8.mjs";
//#region src/cli/gateway-port-option.ts
const MAX_TCP_PORT = 65535;
function parseGatewayPortOption(e, t = "--port") {
if (e === void 0 || e === null) return;
const n = parseStrictPositiveInteger(typeof e === "bigint" ? String(e) : e);
if (n === void 0 || n > MAX_TCP_PORT) throw new Error(`${t} must be an integer between 1 and ${MAX_TCP_PORT}.`);
return n;
}
function resolveGatewayLocalPortOverride(e) {
const t = e.localPortOverride ?? parseGatewayPortOption(e.port);
if (t !== void 0 && typeof e.url === "string" && e.url.trim()) throw new Error("Use either --url or --port, not both.");
return t;
}
//#endregion
export { resolveGatewayLocalPortOverride as n, parseGatewayPortOption as t };