From f0ddf6c5ddbba871496eb77a02bf515e732809fa Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Fri, 4 Oct 2024 01:44:17 +0800 Subject: [PATCH] refactor: add apikey check before setup --- src/server/model/billing.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/server/model/billing.ts b/src/server/model/billing.ts index 31c090e..0760d48 100644 --- a/src/server/model/billing.ts +++ b/src/server/model/billing.ts @@ -7,10 +7,12 @@ import { import { env } from '../utils/env.js'; import { prisma } from './_client.js'; -lemonSqueezySetup({ - apiKey: env.billing.lemonSqueezy.apiKey, - onError: (error) => console.error('Error!', error), -}); +if (env.billing.lemonSqueezy.apiKey) { + lemonSqueezySetup({ + apiKey: env.billing.lemonSqueezy.apiKey, + onError: (error) => console.error('Error!', error), + }); +} export type SubscriptionTierType = keyof typeof env.billing.lemonSqueezy.tierVariantId;