Initial OSS scaffold from Songs2VID (pre-strip)

This commit is contained in:
Songs2VID Support
2026-08-03 06:15:05 +02:00
commit 506d56fa92
195 changed files with 25023 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import Stripe from "stripe";
let stripe: Stripe | null = null;
export function getStripe(): Stripe {
const key = process.env.STRIPE_SECRET_KEY;
if (!key) {
throw new Error("STRIPE_SECRET_KEY is not configured");
}
if (!stripe) {
stripe = new Stripe(key);
}
return stripe;
}
export function isStripeConfigured(): boolean {
return Boolean(process.env.STRIPE_SECRET_KEY);
}
/**
* Bypass Stripe Checkout when:
* - BILLING_DEV_MOCK=true, or
* - development and no STRIPE_SECRET_KEY (so UI still works without stripe listen)
* Set BILLING_DEV_MOCK=false to force real Stripe even without keys (will 503).
*/
export function isBillingDevMock(): boolean {
if (process.env.BILLING_DEV_MOCK === "true") return true;
if (process.env.BILLING_DEV_MOCK === "false") return false;
return process.env.NODE_ENV === "development" && !process.env.STRIPE_SECRET_KEY;
}