From 373d9ec700c0097a22cf665a8e33cf48998d1dc2 Mon Sep 17 00:00:00 2001 From: Elizabeth Date: Mon, 2 Jun 2025 11:14:52 -0700 Subject: Minor things --- server/health.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 server/health.ts (limited to 'server/health.ts') diff --git a/server/health.ts b/server/health.ts new file mode 100644 index 0000000..1acc074 --- /dev/null +++ b/server/health.ts @@ -0,0 +1,28 @@ +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