refactor(server): config system (#11081)

This commit is contained in:
forehalo
2025-03-27 12:32:28 +00:00
parent 7091111f85
commit 0ea38680fa
274 changed files with 7583 additions and 5841 deletions

View File

@@ -5,17 +5,18 @@ import Stripe from 'stripe';
import { z } from 'zod';
import {
Config,
EventBus,
InternalServerError,
InvalidCheckoutParameters,
Mutex,
Runtime,
SubscriptionAlreadyExists,
SubscriptionPlanNotFound,
TooManyRequest,
URLHelper,
} from '../../../base';
import { EarlyAccessType, FeatureService } from '../../../core/features';
import { StripeFactory } from '../stripe';
import {
CouponType,
KnownStripeInvoice,
@@ -53,15 +54,15 @@ export const UserSubscriptionCheckoutArgs = z.object({
@Injectable()
export class UserSubscriptionManager extends SubscriptionManager {
constructor(
stripe: Stripe,
stripeProvider: StripeFactory,
db: PrismaClient,
private readonly runtime: Runtime,
private readonly config: Config,
private readonly feature: FeatureService,
private readonly event: EventBus,
private readonly url: URLHelper,
private readonly mutex: Mutex
) {
super(stripe, db);
super(stripeProvider, db);
}
async filterPrices(
@@ -588,7 +589,7 @@ export class UserSubscriptionManager extends SubscriptionManager {
{ proEarlyAccess, proSubscribed, onetime }: PriceStrategyStatus
) {
if (lookupKey.recurring === SubscriptionRecurring.Lifetime) {
return this.runtime.fetch('plugins.payment/showLifetimePrice');
return this.config.payment.showLifetimePrice;
}
if (lookupKey.variant === SubscriptionVariant.Onetime) {