headplane/app/routes/util/healthz.ts
2025-01-17 11:46:36 +00:00

19 lines
424 B
TypeScript

import { healthcheck } from '~/utils/headscale';
import log from '~/utils/log';
export async function loader() {
let healthy = false;
try {
healthy = await healthcheck();
} catch (error) {
log.debug('APIC', 'Healthcheck failed %o', error);
}
return new Response(JSON.stringify({ status: healthy ? 'OK' : 'ERROR' }), {
status: healthy ? 200 : 500,
headers: {
'Content-Type': 'application/json',
},
});
}