( input: ExecutorServerReachabilityInput, )
| 86 | }; |
| 87 | |
| 88 | export const isExecutorServerReachable = ( |
| 89 | input: ExecutorServerReachabilityInput, |
| 90 | ): Effect.Effect<boolean> => |
| 91 | Effect.tryPromise(async () => { |
| 92 | // The unauthenticated liveness probe — never forwards a credential, so a |
| 93 | // misconfigured base URL can't leak the bearer token to a third-party host. |
| 94 | const url = new URL("/api/health", input.baseUrl); |
| 95 | const response = await fetch(url, { signal: AbortSignal.timeout(2000) }); |
| 96 | const body = await response.text(); |
| 97 | return response.ok && body.trim() === "ok"; |
| 98 | }).pipe(Effect.catchCause(() => Effect.succeed(false))); |
| 99 | |
| 100 | // --------------------------------------------------------------------------- |
| 101 | // Process spec |
no test coverage detected