-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add autofill for posthog props in plugin config #2838
Conversation
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.
Hey, some thoughts below regarding this implementation.
I understand this is needed for some plugins that want to talk to the API (e.g. the github annotations plugin). This will work, though a nicer solution would be to autogenerate and pre-fill this stuff in the plugin-server... and then expose some api
object that can be called that has the right authentication already pre-filled. That's obviously more work though... :)
Finally had a little time to come back to this - all addressed @mariusandra Also completely agree it is far from the best solution. I'd love to have access to more if not all of the PostHog API directly in the plugin, but while that's not the case this will just make things easier for people looking to use the GitHub and GitLab plugins (which work on Cloud!) |
Hey! Finally had the time to review it. I made quite some changes and cleanup though. Playing with this now, I think we need some "secret" or "write-only" field type for plugins, so that this key wouldn't be shown all the time. As in, someone could go into "plugins" and read their boss's personal API key and do something with it. I had a need for it with the github star sync plugin for example. |
Changes
This autofills two PostHog-related config values for plugins:
posthogHost
posthogApiKey
Ideally in the future we would expand the plugin server with more PostHog functionality beyond events. However, at the moment there are things that can be done by hitting the PostHog API. For example, the release tracking plugins hit the annotations endpoint to generate annotations for each new release in your repo.
To do that, they need a host and a key. So this PR grabs the host from the window and creates an API key so that you don't have to.
Checklist