-
-
Notifications
You must be signed in to change notification settings - Fork 524
Respect DEFAULT_BILLING_MODE env var for self-hosters #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@cfurrow is attempting to deploy a commit to the Workoutcool Team Team on Vercel. A member of the Team first needs to authorize it. |
it reads in the env variable details about the current billing mode
…lling mode (disabled, freemium, etc)
…s disabled, or freemium
9ad6590 to
fea6dec
Compare
| // Don't show ads if billing is disabled (self-hosted instances with no billing) | ||
| if (billingMode === "DISABLED") { | ||
| return <>{fallback}</>; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should "FREEMIUM" still show ads? It would in this case, and only disable ads if user is premium, or if the billing mode was "DISABLED"
| DEFAULT_BILLING_MODE: z | ||
| .enum(["DISABLED", "LICENSE_KEY", "SUBSCRIPTION", "FREEMIUM"]) | ||
| .default("DISABLED"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a breaking change if DEFAULT_BILLING_MODE is not currently set in environments, we would be defaulting to "disabled" which may not be expected. I'll note this in the PR description.
📝 Description
As pointed out in issue #177, the
DEFAULT_BILLING_MODEenv variable does not appear to be respected or used, and the premium "gates" and ads still show when self hosting and setting that variable to "DISABLED" or "FREEMIUM".Looking at the code, it appears that using this env var was not implemented yet.
This PR creates a centralized place to retrieve the billing configuration details, and also hides any premium gates or ads if the billing config is disabled or set to "freemium".
NOTE: I used Claude Code to help me find all places that needed new billing config logic introduced that would support the "disabled" or "freemium" values of DEFAULT_BILLING_MODE.
📋 Checklist
🗃️ Prisma Migrations (if applicable)
📸 Screenshots (if applicable)
Premium status is "active" when setting
DEFAULT_BILLING_MODE="DISABLED"Statistics page does not render the "upgrade" overlay when

DEFAULT_BILLING_MODE="DISABLED"The "remove ads" link is removed when

DEFAULT_BILLING_MODE="DISABLED"I created a "premium" program, and all users can see/use it when
DEFAULT_BILLING_MODE="DISABLED"And more, I'm sure.
🔗 Related Issues
#177