ngrok / ngrok-javascript

Embed ngrok secure ingress into your Node.js apps with a single line of code.
https://ngrok.com
Apache License 2.0
94 stars 18 forks source link

I would like to use authtoken in $HOME/.config/ngrok/ngrok.yml #110

Closed sinofseven closed 8 months ago

sinofseven commented 9 months ago

I use authtoken listed in $HOME/.config/ngrok/ngrok.yml in CLI.

I would like to use authtoken listed in $HOME/.config/ngrok/ngrok.yml. Currently it doesn't seem to work, What do you think?

bobzilladev commented 9 months ago

Hello, thanks for your feedback! There would be a way to inject the authtoken using the environment variable on the command line, as long as authtoken_from_env: true is set, with something like:

NGROK_AUTHTOKEN=`grep authtoken $HOME/.config/ngrok/ngrok.yml | awk '{print $2}'` node ngrok-forward-minimal.js

While there's no automatic method, it's also possible to write code grab the authtoken from that file and set it with authtoken: token in forward(), or ngrok.authtoken(token) to use it by default for all forward() calls, or using the authtoken(token) method on the SessionBuilder (if using the builders for configuration).

sinofseven commented 9 months ago

The CLI reads from the configuration file without doing anything special.

We would like to change this in the SDK as well.

What are the pros and cons of making changes to the SDK?

bobzilladev commented 9 months ago

Hi, sorry for the delay in responding. The ngrok.yml is a configuration file specifically for the ngrok Agent, and isn't slated to be part of how the SDK's are configured. We know there is a desire to have something like this so there have been discussions around the future of configuration. For now using the environment variable or adding code to the project is the way to get the authtoken in to the SDK. Thank you for your feedback!

sinofseven commented 8 months ago

I understand. Thank you very much.