openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
34 lines (33 loc) • 1.23 kB
JavaScript
import { t as isMainModule } from "./is-main-DHs8alyJ.mjs";
import { b as resolveGatewayPort, d as parseGatewayPortEnvValue } from "./paths-DAcAg5aV.mjs";
import { t as createConfigIO } from "./io.factory-DEa_bi2j.mjs";
import "./config-CMA-J084.mjs";
import { s as readActiveGatewayLockPort } from "./gateway-lock-IYOwJQai.mjs";
import { fileURLToPath } from "node:url";
//#region src/docker-healthcheck.ts
async function resolveDockerHealthcheckPort() {
try {
const e = await readActiveGatewayLockPort({ env: process.env });
if (e !== void 0) return e;
} catch {}
const e = parseGatewayPortEnvValue(process.env.OPENCLAW_GATEWAY_PORT);
if (e !== null) return e;
const t = await createConfigIO({
pluginValidation: "skip",
shellEnvFallback: "defer"
}).loadConfigAsync();
return resolveGatewayPort(t, process.env);
}
async function probeDockerGatewayHealth() {
try {
const e = await resolveDockerHealthcheckPort();
return (await globalThis.fetch(`http://127.0.0.1:${e}/healthz`)).ok;
} catch {
return false;
}
}
if (isMainModule({ currentFile: fileURLToPath(import.meta.url) })) probeDockerGatewayHealth().then((e) => {
process.exitCode = e ? 0 : 1;
});
//#endregion
export { probeDockerGatewayHealth };