mirror of
https://github.com/hanzoai/sign.git
synced 2026-11-02 23:26:15 +00:00
The resource API is /v1/rest and the operation API is /v1/rpc: named for what they are, so neither shadows the other, and the v2-beta alias is gone. Hanzo IAM returns to /auth/callback, the callback path IAM already derives for this host, so sign-in needs no IAM change. Claude-Session: https://claude.ai/code/session_01TUxvfuta1Z44KVNYuAz71F
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
import { getCertificateStatus } from '@hanzo/esign-lib/server-only/cert/cert-status';
|
|
import { prisma } from '@hanzo/esign-prisma';
|
|
|
|
type CheckStatus = 'ok' | 'warning' | 'error';
|
|
|
|
export const loader = async () => {
|
|
const checks: {
|
|
database: { status: CheckStatus };
|
|
certificate: { status: CheckStatus };
|
|
} = {
|
|
database: { status: 'ok' },
|
|
certificate: { status: 'ok' },
|
|
};
|
|
|
|
let overallStatus: CheckStatus = 'ok';
|
|
|
|
try {
|
|
await prisma.$queryRaw`SELECT 1`;
|
|
} catch {
|
|
checks.database = { status: 'error' };
|
|
overallStatus = 'error';
|
|
}
|
|
|
|
try {
|
|
const certStatus = getCertificateStatus();
|
|
|
|
if (certStatus.isAvailable) {
|
|
checks.certificate = { status: 'ok' };
|
|
} else {
|
|
checks.certificate = { status: 'warning' };
|
|
|
|
if (overallStatus === 'ok') {
|
|
overallStatus = 'warning';
|
|
}
|
|
}
|
|
} catch {
|
|
checks.certificate = { status: 'error' };
|
|
overallStatus = 'error';
|
|
}
|
|
|
|
return Response.json(
|
|
{
|
|
status: overallStatus,
|
|
timestamp: new Date().toISOString(),
|
|
checks,
|
|
},
|
|
{ status: overallStatus === 'error' ? 500 : 200 },
|
|
);
|
|
};
|