Skip to content
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

feat: usage base billed - license key check - move to private api #15222

Merged
merged 48 commits into from
Jul 25, 2024

Conversation

sean-brydon
Copy link
Member

@sean-brydon sean-brydon commented May 28, 2024

Not to be merged until private api has been deployed and migrations have been applied and we are ready to switch

More info here https://app.campsite.co/cal/posts/xdwtm9bcavqq

Copy link
Contributor

github-actions bot commented May 28, 2024

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

Unknown release type "Feat" found in pull request title "Feat: usage base billed - license key check - move to private api". 

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@keithwillcode keithwillcode added consumer core area: core, team members only labels May 28, 2024
@sean-brydon sean-brydon changed the base branch from main to feat/license-creation-fe-ui May 28, 2024 13:25
Copy link

vercel bot commented May 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2024 5:36pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Jul 25, 2024 5:36pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Jul 25, 2024 5:36pm

@@ -1,9 +1,13 @@
import type { PrismaClient } from "@calcom/prisma";

export async function getDeploymentKey(prisma: PrismaClient) {
if (process.env.CALCOM_LICENSE_KEY) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes more sense to early return here if its found in .env. Saves a redundant db call

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the DB is the preferred way to check/save the key. The env one is only for backwards compatibility. If a self hosted uses the wizard to set update the key, then it will never reach it unless it manually removes it from env. Although it makes sense to alert the user that it might have differing keys in the DB/env.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get this - but to set the license key in the wizard it needs to be set in the .env.

https://app.campsite.co/cal/posts/zxcq11vnt6tg#comment-l2toxbc9dr55

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restores this to what it is in main (this is a based branch off the frontend changes for this api feature).
This file won't get used in newer self hosted instances. But will leave it here for now so we can track what happens with old self hosted instances.

@zomars
Copy link
Member

zomars commented Jul 24, 2024

@sean-brydon I need more context on CAL_SIGNATURE_TOKEN. Why is needed? Where in the code can I find more info about how to set it up?. What happens if a self hoster doesn't set it up properly?

Signed-off-by: zomars <zomars@me.com>
@zomars
Copy link
Member

zomars commented Jul 24, 2024

Pushed a fix that hopefully get unit tests working.

@sean-brydon
Copy link
Member Author

@sean-brydon I need more context on CAL_SIGNATURE_TOKEN. Why is needed? Where in the code can I find more info about how to set it up?. What happens if a self hoster doesn't set it up properly?

Hi zomars - i have DM'd you a bit more info but TLDR.

Its use to ensure self hosters can only increase billing ƒor their instance when signature tokens match

@zomars zomars merged commit e16662e into main Jul 25, 2024
50 of 52 checks passed
@zomars zomars deleted the feat/usage-based-billing-self-hosted branch July 25, 2024 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consumer core area: core, team members only ❗️ .env changes contains changes to env variables ✨ feature New feature or request Medium priority Created by Linear-GitHub Sync ready-for-e2e security
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants