Files
adminandClaude Opus 4.8 ba96566c14 feat(infra): payments (Stripe), auth scaffold, engine bridge, embeds, .env.example
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>
2026-06-24 21:19:29 +02:00

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;
}