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 support for ngrok #165
Conversation
This PR is now ready for review. ✅ |
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.
Thank you for this addition, @arunsathiya ! You're on fire with all these new plugins, absolutely love it ❤️ I've left a few comments below.
Thanks for all the comments, @hculea. I have addressed your feedback above, but as a last step, we are waiting for ngrok staff to respond to my Slack question. I'll followup as soon as I hear from them. |
Just so it isn't missed, I shared the latest update here. |
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.
From my understanding after reading ngrok
's documentation, it authenticates with either the auth token or the api key (they are not both required at the same time right?).
It could be the case that they are both required, as I am not too familiar with ngrok
documentation. In this case, the current solution is definitely the way to go for now, since the env vars are out of the question because the api key is not covered.
In the case where they are not both required at the same time, I'm understanding that your reason for going for the config file provisioner is to allow users to choose between the 2 different authentication formulas, since the config file supports both while env vars do not.
-
However, the structure of the current plugin is in such a way that users cannot really choose between them, but they should rather have both, because these fields are both denoted with
Optional: false
. -
If you want users to be able to choose between both of them you would have to specify
Optional:true
for both. Then this would also not be right because at least 1 is required.
To avoid these complications I would suggest just going ahead with the env var approach, and only support the auth token. In this way we also avoid storing the non-secret version in 1Password.
What do you think @arunsathiya ?
Thanks for your detailed review, @AndyTitu! Regarding the Authtoken vs API Key confusion, all commands require the Authtoken with the exception of https://ngrok.com/docs/ngrok-agent/ngrok#ngrok-api I have also tested running Having said that, the ngrok team fixed envvar support for API key as of yesterday. It's just a matter of waiting for the update to be available to the general public, which I don't have a timeline on: At this point, we could wait for that updated version to be available and then provision credentials as envvars, or if we want to get this out right now, we can:
Could you elaborate on this part, please? Did you mean to say that API Token is not considered a secret credential? |
Thanks for the additional information @arunsathiya ! In my opinion, the best way ahead given our current situation would be to go ahead with the current state of this PR, with only a small change added. To clarify, this is what I'm looking for (mostly we should already be there):
This will avoid having to wait on 3rd party releases. When their release is out we could file a change for moving over to env vars to get rid of the need to specify the version. |
I have opened #182 for us to look into supporting different credential types for different commands. In the meantime, we can proceed with either having support for just the auth token and no support for the |
Thanks @AndyTitu and @SimonBarendse, I am on board with this approach as well. This PR is ready for one final look. 🤞🏼 But, the test is failing with undefined credname.Credentials. I see it okay here though: Is there a way to re-run tests without having to push a new commit? |
We need to re-add the credential type, we removed it assuming it wasn't used here: #161 (comment) Could you pull in |
@arunsathiya I've re-opened an old discussion here: #165 (comment) |
…mmand is used for adding an Auth Token or API Key to local config file, or to check if config file (either local or 1Password-generated) are valid. To avoid complications with custom config files, it's best to skip 1Password auth for config subcommands
b957d28
to
e839476
Compare
…ly by the CLI program and is not a configurable value by the user
Thanks for the pointer, Simon. Rebased and tests now pass. ✅ Agree on hardcoding the version number; precisely why I had set that up as such in the first place. |
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.
Love your work on this @arunsathiya! Thank you for figuring out the differences between Auth Token and API Key and a way to move forward with this. The plugin is in a great spot! Looking forward to release this one soon 🚀
Once we've tackled #182, we can re-visit this plugin to polish it further with first-class support for the ngrok api
commands.
Thanks again! 🙌
@SimonBarendse @hculea A quick note that I had previously incorrectly understood that I was testing only I now have a fix for it here: Would we be able to release a patch build? My apologies for the hassle here. |
This PR adds support for ngrok. Fixes #156
Testing instructions
make ngrok/build
op plugin init ngrok
export NGROK_AUTHTOKEN=token
andexport NGROK_API_KEY=token
and then runop plugin init ngrok
~/Library/Application Support/ngrok/ngrok.yml
if you are on Mac, or at~/.config/ngrok/ngrok.yml
if you are on Linux, and then runop plugin init ngrok
ngrok
without any commands or args does not prompt for 1Password auth.ngrok api tunnels list
andngrok http 80
work (first is API key test and the second is Auth Token test; for the second, you can see your account name on the generated tunnel)Sample config
Notes
NGROK_AUTHTOKEN
andNGROK_API_KEY
butngrok api
commands fail even with the second env var set. I have asked about it here: ngrok API doesn't work with environment variable set inconshreveable/ngrok#895