/** * Starts the tap consumer that projects records into the read model. * * Imported for its side effect from the server entrypoint, so the consumer * always runs alongside the app. The consumer reconnects on its own. */ import { getDb } from "../db/client.js"; import { TapConsumer } from "./consumer.js"; // Default on. Set ENABLE_CONSUMER=false to run the app without indexing // (e.g. a second app replica that only serves reads, or local UI work). if (process.env.ENABLE_CONSUMER === "false") { console.log("Tap consumer disabled (ENABLE_CONSUMER=false)"); } else { const consumer = new TapConsumer(getDb()); consumer.start().catch((err) => { console.error("Tap consumer failed to start:", err); }); }