Env-guarded so build stays green: /api/payments/[order_id]/deposit+release + /api/webhooks/stripe (lazy Stripe, 50/50 escrow, 501 until keys); /api/auth login|me|logout (HMAC signed-session scaffold, guarded dev login); lib/engine bridges edge->FastAPI (estimates defers to ENGINE_URL when set); components/embed for NocoDB/Metabase signed URLs; .env.example full inventory. tsc 0, build green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
13 lines
402 B
TypeScript
13 lines
402 B
TypeScript
import Stripe from "stripe";
|
|
|
|
// Lazy, env-guarded Stripe client. Returns null when STRIPE_SECRET_KEY is unset
|
|
// so the app builds/runs without keys; payment routes 501 until configured.
|
|
let _stripe: Stripe | null = null;
|
|
|
|
export function getStripe(): Stripe | null {
|
|
const key = process.env.STRIPE_SECRET_KEY;
|
|
if (!key) return null;
|
|
if (!_stripe) _stripe = new Stripe(key);
|
|
return _stripe;
|
|
}
|