Add documentation to `replit.md` to specify `artifact.toml` as the canonical deployment configuration and enhance comments in `routes/index.ts` to explain operational tradeoffs for stub mode. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 90c7a60b-2c61-4699-b5c6-6a1ac7469a4d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: f46cc2d3-95ce-4f2b-8ab1-d8cd41d10743 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/9f85e954-647c-46a5-90a7-396e495a805a/90c7a60b-2c61-4699-b5c6-6a1ac7469a4d/G03TLre Replit-Helium-Checkpoint-Created: true
54 lines
2.1 KiB
TypeScript
54 lines
2.1 KiB
TypeScript
import { Router, type IRouter } from "express";
|
|
import healthRouter from "./health.js";
|
|
import jobsRouter from "./jobs.js";
|
|
import bootstrapRouter from "./bootstrap.js";
|
|
import sessionsRouter from "./sessions.js";
|
|
import demoRouter from "./demo.js";
|
|
import devRouter from "./dev.js";
|
|
import testkitRouter from "./testkit.js";
|
|
import { lnbitsService } from "../lib/lnbits.js";
|
|
import uiRouter from "./ui.js";
|
|
import nodeDiagnosticsRouter from "./node-diagnostics.js";
|
|
import metricsRouter from "./metrics.js";
|
|
import worldRouter from "./world.js";
|
|
import identityRouter from "./identity.js";
|
|
import estimateRouter from "./estimate.js";
|
|
import relayRouter from "./relay.js";
|
|
import adminRelayRouter from "./admin-relay.js";
|
|
import adminRelayQueueRouter from "./admin-relay-queue.js";
|
|
|
|
const router: IRouter = Router();
|
|
|
|
router.use(healthRouter);
|
|
router.use(metricsRouter);
|
|
router.use(jobsRouter);
|
|
router.use(estimateRouter);
|
|
router.use(bootstrapRouter);
|
|
router.use(sessionsRouter);
|
|
router.use(identityRouter);
|
|
router.use(relayRouter);
|
|
router.use(adminRelayRouter);
|
|
router.use(adminRelayQueueRouter);
|
|
router.use(demoRouter);
|
|
router.use(testkitRouter);
|
|
router.use(uiRouter);
|
|
router.use(nodeDiagnosticsRouter);
|
|
router.use(worldRouter);
|
|
|
|
// Mount dev routes when NOT in production OR when LNbits is in stub mode.
|
|
// Stub mode means there is no real Lightning backend — payments are simulated
|
|
// in-memory. The testkit relies on POST /dev/stub/pay/:hash to simulate payment
|
|
// confirmation, so we expose it whenever stub mode is active regardless of NODE_ENV.
|
|
// In real production with a live LNbits backend, stubMode is false, so these
|
|
// routes remain unexposed.
|
|
//
|
|
// OPERATIONAL TRADEOFF: Running the testkit against a live node with LNBITS_STUB=true
|
|
// (e.g. for CI without a real Lightning backend) will expose dev routes in that
|
|
// process. This is intentional — stub mode has no real funds, so the exposure
|
|
// is harmless. Never set LNBITS_STUB=true on a node with a real LNbits backend.
|
|
if (process.env.NODE_ENV !== "production" || lnbitsService.stubMode) {
|
|
router.use(devRouter);
|
|
}
|
|
|
|
export default router;
|