openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
33 lines (32 loc) • 1.15 kB
JavaScript
import { t as isMainModule } from "./is-main-DYSvvM1W.mjs";
import { b as resolveGatewayPort } from "./paths-BP0DYpE8.mjs";
import { r as getRuntimeConfig } from "./io.runtime-B134MOMz.mjs";
import "./config-VnHbY_QV.mjs";
import { s as readActiveGatewayLockPort } from "./gateway-lock-Dw3jf-HK.mjs";
import { fileURLToPath } from "node:url";
//#region src/docker-healthcheck.ts
async function resolveDockerHealthcheckPort() {
try {
const activePort = await readActiveGatewayLockPort({ env: process.env });
if (activePort !== void 0) return activePort;
} catch {}
const config = getRuntimeConfig({
pin: false,
skipPluginValidation: true,
skipShellEnvFallback: true
});
return resolveGatewayPort(config, process.env);
}
async function probeDockerGatewayHealth() {
try {
const port = await resolveDockerHealthcheckPort();
return (await 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 };