forked from cartsnitch/cartsnitch
fix(auth): add DB connectivity check to health endpoint
- Export pool from auth.ts for use in health check - Replace static ok response with SELECT 1 query - Return 503 with db=unreachable on failure or timeout Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -7,7 +7,6 @@ const port = parseInt(process.env.PORT ?? "3001", 10);
|
|||||||
const handler = toNodeHandler(auth);
|
const handler = toNodeHandler(auth);
|
||||||
|
|
||||||
const server = createServer(async (req, res) => {
|
const server = createServer(async (req, res) => {
|
||||||
// Health check
|
|
||||||
if (req.url === "/health" && req.method === "GET") {
|
if (req.url === "/health" && req.method === "GET") {
|
||||||
try {
|
try {
|
||||||
const client = await pool.connect();
|
const client = await pool.connect();
|
||||||
|
|||||||
Reference in New Issue
Block a user