20 lines
730 B
TypeScript
20 lines
730 B
TypeScript
import { loadWebConfig } from "@hivegrid/config";
|
|
import type { LoaderFunctionArgs } from "react-router";
|
|
import { getWebServiceName } from "../../build-surface";
|
|
|
|
export const loader = async (args?: Pick<LoaderFunctionArgs, "request">) => {
|
|
// Keep liveness cheap: no dependency checks or database access.
|
|
const { releaseRevision, runtimeSurface } = loadWebConfig().config;
|
|
const host = runtimeSurface === "portal" && args?.request ? new URL(args.request.url).hostname.toLowerCase() : null;
|
|
return Response.json(
|
|
{
|
|
status: "ok",
|
|
service: getWebServiceName(runtimeSurface),
|
|
surface: runtimeSurface,
|
|
revision: releaseRevision,
|
|
...(host ? { host } : {}),
|
|
},
|
|
{ status: 200 }
|
|
);
|
|
};
|