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

Private token support for GitHub and npm URLs #3070

Merged
merged 11 commits into from
Jan 25, 2021
Merged

Conversation

mariusandra
Copy link
Collaborator

Changes

  • In addition to Github, now private token support is also enabled for GitHub and npm URLs.
  • This is necessary to make plugin updates work with github, where we (or the project) will need to enter a global API token in order to not be hit with the 60 requests/min API limit.

Checklist

  • All querysets/queries filter by Organization, by Team, and by User
  • Django backend tests
  • Jest frontend tests
  • Cypress end-to-end tests

@mariusandra mariusandra requested a review from Twixes January 25, 2021 10:53
@timgl timgl temporarily deployed to posthog-plugin-api-keys-yv4uzu January 25, 2021 10:56 Inactive
frontend/src/scenes/plugins/install/CustomPlugin.tsx Outdated Show resolved Hide resolved
posthog/plugins/utils.py Outdated Show resolved Hide resolved
@mariusandra mariusandra temporarily deployed to posthog-plugin-api-keys-yv4uzu January 25, 2021 12:07 Inactive
@mariusandra mariusandra temporarily deployed to posthog-plugin-api-keys-yv4uzu January 25, 2021 12:13 Inactive
@mariusandra
Copy link
Collaborator Author

Thanks! Did some slight improvements to the code and the interface:

image

@mariusandra mariusandra requested a review from Twixes January 25, 2021 12:13
@mariusandra mariusandra temporarily deployed to posthog-plugin-api-keys-yv4uzu January 25, 2021 12:42 Inactive
@mariusandra mariusandra temporarily deployed to posthog-plugin-api-keys-yv4uzu January 25, 2021 12:51 Inactive
@mariusandra
Copy link
Collaborator Author

I added two other things and it's ready for a review again.

  • GitLab API requests now also use a Header instead of passing the token in the URL query string
  • I added global NPM_TOKEN, GITLAB_TOKEN and GITHUB_TOKEN settings. The idea is, at least for cloud, to use a custom GITHUB token in order to get around the 60 requests/hour limit, which makes plugins unusable after a while. Every time we check for a new version or install a plugin, this API is hit, and the 1 requests per minute limit is way too low.
  • This could be set per Project/Organization later, but that's scope creep right now.

@mariusandra mariusandra mentioned this pull request Jan 25, 2021
4 tasks
Copy link
Member

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

Looks good.
Didn't notice any way to extract the tokens out of PostHog. 🤔

@mariusandra
Copy link
Collaborator Author

I think that's a good thing...? 🤔 See also #3082

Thanks for the review! Will fix the conflict and merge.

@mariusandra mariusandra temporarily deployed to posthog-plugin-api-keys-yv4uzu January 25, 2021 23:15 Inactive
@mariusandra mariusandra merged commit 64f282b into master Jan 25, 2021
@mariusandra mariusandra deleted the plugin-api-keys branch January 25, 2021 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants