From 70bc894e453d060e7f20f77feb59cb8ec68040d4 Mon Sep 17 00:00:00 2001 From: Ryan Moon Date: Fri, 3 Apr 2026 22:12:42 -0500 Subject: [PATCH] fix: use customer db url with password for pgbouncer health check --- src/routes/customers.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes/customers.ts b/src/routes/customers.ts index 54784eb..a6f8dd4 100644 --- a/src/routes/customers.ts +++ b/src/routes/customers.ts @@ -240,9 +240,11 @@ export async function customerRoutes(app: FastifyInstance) { await sql.end(); } })(), - // Try connecting via pgbouncer + // Try connecting via pgbouncer using the customer's db url from k8s secret (async () => { - const sql = postgres(`postgresql://${slug}@${PGBOUNCER_HOST}:${PGBOUNCER_PORT}/${slug}`, { max: 1, connect_timeout: 5 }); + const secrets = await getSecret(namespace, "lunarfront-secrets").catch(() => null); + if (!secrets?.["database-url"]) return false; + const sql = postgres(secrets["database-url"], { max: 1, connect_timeout: 5 }); try { await sql`SELECT 1`; return true;