From d51c9d74857aca3c2f172609297266968bc7f809 Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Mon, 12 May 2025 09:40:12 -0700 Subject: The big refactor TM --- hooks/server/health.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 hooks/server/health.ts (limited to 'hooks/server/health.ts') diff --git a/hooks/server/health.ts b/hooks/server/health.ts new file mode 100644 index 0000000..2f67aa4 --- /dev/null +++ b/hooks/server/health.ts @@ -0,0 +1,25 @@ +import { + getRequiredEnv, + getStdout, + type HealthChecker, + type HealthCheckInput, + HealthCheckOutput, + type IEither, + type ITraceable, + type ServerTrace, + TraceUtil, +} from "@emprespresso/pengueno"; + +export const healthCheck: HealthChecker = ( + input: ITraceable, +): Promise> => + input.bimap(TraceUtil.withFunctionTrace(healthCheck)) + .move(getRequiredEnv("LAMINAR_HOST")) + // ensure LAMINAR_HOST is propagated to getStdout for other procedures + .map((e) => e.get().moveRight(["laminarc", "show-jobs"])) + .map((i) => + i.get().mapRight(i.move.apply) + .flatMapAsync(getStdout.apply) + .then((gotJobs) => gotJobs.moveRight(HealthCheckOutput.YAASSSLAYQUEEN)) + ) + .get(); -- cgit v1.2.3-70-g09d2