chore: expose deployment identity in health

This commit is contained in:
732642856
2026-07-19 09:24:38 +08:00
parent 82e7b0a95a
commit b5a416bc21
2 changed files with 20 additions and 0 deletions
+8
View File
@@ -7,6 +7,11 @@ type Check = {
};
const jyotishApiBase = process.env.JYOTISH_API_BASE ?? "http://127.0.0.1:5200";
const gitCommit =
process.env.GITHUB_SHA
?? process.env.VERCEL_GIT_COMMIT_SHA
?? process.env.NEXT_PUBLIC_GIT_COMMIT
?? "unknown";
function envCheck(names: string[]): Check {
const missing = names.filter((name) => !process.env[name]);
@@ -65,6 +70,9 @@ export async function GET() {
{
status,
timestamp: new Date().toISOString(),
deployment: {
gitCommit,
},
checks,
},
{ status: status === "ok" ? 200 : 503 },
+12
View File
@@ -0,0 +1,12 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
test("health endpoint exposes deployment identity for production verification", () => {
const source = readFileSync(new URL("../src/app/api/health/route.ts", import.meta.url), "utf8");
assert.match(source, /deployment:/);
assert.match(source, /GITHUB_SHA/);
assert.match(source, /VERCEL_GIT_COMMIT_SHA/);
assert.match(source, /gitCommit/);
});