feat(buyer): PDF_ENABLED kill switch for the PDF summarizer

PDF_ENABLED=0 skips the JobStore/PdfJobDb wiring in runMain, so every
/v1/pdf-* route responds 503 (the pre-existing disabled path). Default
stays enabled; only "0"/"1" accepted, misconfig fails boot loudly.
This commit is contained in:
david
2026-08-21 02:14:32 +02:00
parent c531e4678f
commit 5221815a71
5 changed files with 62 additions and 22 deletions

View File

@@ -87,6 +87,19 @@ describe("loadConfig(env)", () => {
const env = { ...VALID_ENV, COOKIE_SECURE: "true" };
expect(() => loadConfig(env)).toThrow(/COOKIE_SECURE/);
});
it("defaults pdfEnabled to true when PDF_ENABLED is not provided", () => {
expect(loadConfig(VALID_ENV).pdfEnabled).toBe(true);
});
it('honours PDF_ENABLED="0" (summarizer kill switch)', () => {
const config = loadConfig({ ...VALID_ENV, PDF_ENABLED: "0" });
expect(config.pdfEnabled).toBe(false);
});
it("throws when PDF_ENABLED is not 0 or 1", () => {
expect(() => loadConfig({ ...VALID_ENV, PDF_ENABLED: "false" })).toThrow(/PDF_ENABLED/);
});
});
// ─── createApp tests ──────────────────────────────────────────────────────────