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:
@@ -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 ──────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user