summaryrefslogtreecommitdiff
path: root/server/health.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/health.ts')
-rw-r--r--server/health.ts48
1 files changed, 20 insertions, 28 deletions
diff --git a/server/health.ts b/server/health.ts
index e69077b..8435865 100644
--- a/server/health.ts
+++ b/server/health.ts
@@ -1,32 +1,24 @@
import {
- getRequiredEnv,
- getStdout,
- type HealthChecker,
- type HealthCheckInput,
- HealthCheckOutput,
- type IEither,
- type ITraceable,
- type ServerTrace,
- TraceUtil,
-} from "@emprespresso/pengueno";
+ getRequiredEnv,
+ getStdout,
+ type HealthChecker,
+ type HealthCheckInput,
+ HealthCheckOutput,
+ type IEither,
+ type ITraceable,
+ type ServerTrace,
+ TraceUtil,
+} from '@emprespresso/pengueno';
export const healthCheck: HealthChecker = (
- input: ITraceable<HealthCheckInput, ServerTrace>,
+ input: ITraceable<HealthCheckInput, ServerTrace>,
): Promise<IEither<Error, HealthCheckOutput>> =>
- input
- .bimap(TraceUtil.withFunctionTrace(healthCheck))
- .move(getRequiredEnv("LAMINAR_HOST"))
- // ensure LAMINAR_HOST is propagated to getStdout for other procedures
- .map((tEitherEnv) =>
- tEitherEnv
- .get()
- .flatMapAsync((_hasEnv) =>
- getStdout(tEitherEnv.move(["laminarc", "show-jobs"])),
- ),
- )
- .map(
- TraceUtil.promiseify((stdout) =>
- stdout.get().moveRight(HealthCheckOutput.YAASSSLAYQUEEN),
- ),
- )
- .get();
+ input
+ .bimap(TraceUtil.withFunctionTrace(healthCheck))
+ .move(getRequiredEnv('LAMINAR_HOST'))
+ // ensure LAMINAR_HOST is propagated to getStdout for other procedures
+ .map((tEitherEnv) =>
+ tEitherEnv.get().flatMapAsync((_hasEnv) => getStdout(tEitherEnv.move(['laminarc', 'show-jobs']))),
+ )
+ .map(TraceUtil.promiseify((stdout) => stdout.get().moveRight(HealthCheckOutput.YAASSSLAYQUEEN)))
+ .get();