mirror of
https://github.com/tale/headplane.git
synced 2026-09-01 01:38:21 +00:00
0512565f8e
Apparently I didn't use my brain cells and rely on the /version endpoint that Headscale has exposed since 0.26 (our lowest supported version). Switching to that significantly simplifies the API surface.
15 lines
431 B
TypeScript
15 lines
431 B
TypeScript
import type { Route } from "./+types/healthz";
|
|
|
|
export async function loader({ context }: Route.LoaderArgs) {
|
|
// Use a fake API key for healthcheck
|
|
const api = context.headscale.client("fake-api-key");
|
|
const healthy = await api.isHealthy();
|
|
|
|
return new Response(JSON.stringify({ status: healthy ? "OK" : "ERROR" }), {
|
|
status: healthy ? 200 : 500,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
});
|
|
}
|