feat(GRO-390): restart-on-save for auth provider config

Adds reinitAuth() for in-process auth re-init after PUT/DELETE on /api/admin/auth-provider. Sessions survive (DB-backed). Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit was merged in pull request #217.
This commit is contained in:
groombook-engineer[bot]
2026-04-03 08:48:28 +00:00
committed by GitHub
parent 2829c19b11
commit 38ce40ca39
2 changed files with 19 additions and 0 deletions
@@ -3,6 +3,7 @@ import { zValidator } from "@hono/zod-validator";
import { z } from "zod/v3";
import { eq, getDb, authProviderConfig, encryptSecret } from "@groombook/db";
import { requireSuperUser } from "../../middleware/rbac.js";
import { reinitAuth } from "../../lib/auth.js";
export const authProviderRouter = new Hono();
@@ -104,6 +105,8 @@ authProviderRouter.put(
.returning();
}
await reinitAuth();
// Return config with secret redacted
return c.json({
id: saved!.id,
@@ -186,5 +189,7 @@ authProviderRouter.delete("/", requireSuperUser(), async (c) => {
await db.delete(authProviderConfig).where(eq(authProviderConfig.id, existing.id));
await reinitAuth();
return c.json({ ok: true, message: "Auth provider config removed; auth will fall back to env vars" });
});