UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

35 lines (34 loc) 1.34 kB
import { t as isMainModule } from "./is-main-CH4EEB_R.js"; import { n as getRuntimeConfig } from "./io.runtime-B9iJRs3w.js"; import { _ as resolveGatewayPort } from "./paths-D2sRr1a_.js"; import "./config-Cs0XXL3x.js"; import { a as readActiveGatewayLockPort } from "./gateway-lock-B0QIxQaj.js"; import { fileURLToPath } from "node:url"; //#region src/docker-healthcheck.ts async function resolveDockerHealthcheckPort(deps = {}) { const env = deps.env ?? process.env; const readActivePort = deps.readActiveGatewayLockPort ?? readActiveGatewayLockPort; try { const activePort = await readActivePort({ env }); if (activePort !== void 0) return activePort; } catch {} const config = (deps.getRuntimeConfig ?? (() => getRuntimeConfig({ pin: false, skipPluginValidation: true, skipShellEnvFallback: true })))(); return (deps.resolveGatewayPort ?? resolveGatewayPort)(config, env); } async function probeDockerGatewayHealth(deps = {}) { try { const port = await resolveDockerHealthcheckPort(deps); return (await (deps.fetch ?? globalThis.fetch)(`http://127.0.0.1:${port}/healthz`)).ok; } catch { return false; } } if (isMainModule({ currentFile: fileURLToPath(import.meta.url) })) probeDockerGatewayHealth().then((healthy) => { process.exitCode = healthy ? 0 : 1; }); //#endregion export { probeDockerGatewayHealth };