refactor(dokploy): remove stripe from global scope

This commit is contained in:
Mauricio Siu
2024-10-24 01:10:17 -06:00
parent bcc7afa3e4
commit fa053b4d1f
2 changed files with 5 additions and 11 deletions

View File

@@ -6,11 +6,6 @@ import { asc, eq } from "drizzle-orm";
import type { NextApiRequest, NextApiResponse } from "next";
import Stripe from "stripe";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", {
apiVersion: "2024-09-30.acacia",
maxNetworkRetries: 3,
});
const endpointSecret = process.env.STRIPE_WEBHOOK_SECRET || "";
export const config = {
@@ -26,6 +21,11 @@ export default async function handler(
if (!endpointSecret) {
return res.status(400).send("Webhook Error: Missing Stripe Secret Key");
}
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", {
apiVersion: "2024-09-30.acacia",
maxNetworkRetries: 3,
});
const buf = await buffer(req);
const sig = req.headers["stripe-signature"] as string;

View File

@@ -1,14 +1,8 @@
import Stripe from "stripe";
export const WEBSITE_URL =
process.env.NODE_ENV === "development"
? "http://localhost:3000"
: "https://app.dokploy.com";
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", {
apiVersion: "2024-09-30.acacia",
});
const BASE_PRICE_MONTHLY_ID = process.env.BASE_PRICE_MONTHLY_ID || ""; // $4.00
const BASE_ANNUAL_MONTHLY_ID = process.env.BASE_ANNUAL_MONTHLY_ID || ""; // $7.99