feat: import upstream ZITADEL Login V2 v4.20.4 source workspace
This commit is contained in:
1 parent
eadd0e558b
commit
4404849fc4
644 files changed
+153201
-10
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { getFips } from "node:crypto";
|
||||
import * as http from "node:http";
|
||||
import * as https from "node:https";
|
||||
|
||||
if (process.env.ZITADEL_FIPS_REQUIRED === "true" && getFips() !== 1) {
|
||||
console.error("Healthcheck failed: FIPS mode required but not enabled");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const scheme = process.env.ZITADEL_TLS_ENABLED === "true" ? "https" : "http";
|
||||
const port = process.env.PORT || "3000";
|
||||
const url = new URL(process.argv[2] || `/ui/v2/login/healthy`, `${scheme}://localhost:${port}`);
|
||||
|
||||
const get = scheme === "https" ? https.get : http.get;
|
||||
|
||||
try {
|
||||
const res = await new Promise((resolve, reject) => {
|
||||
// Safe: localhost-only probe, self-signed certs expected
|
||||
get(url, { rejectUnauthorized: false }, (res) => {
|
||||
res.resume();
|
||||
resolve(res);
|
||||
}).on("error", reject);
|
||||
});
|
||||
process.exit(res.statusCode >= 200 && res.statusCode < 400 ? 0 : 1);
|
||||
} catch (e) {
|
||||
console.error("Healthcheck failed:", e);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in new issue
Block a user