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

Specify an edge for the connection #83

Closed
jimkring opened this issue Jan 4, 2024 · 5 comments
Closed

Specify an edge for the connection #83

jimkring opened this issue Jan 4, 2024 · 5 comments
Assignees

Comments

@jimkring
Copy link

jimkring commented Jan 4, 2024

In the parameters for ngrok.forward() (see full configuration param's list) I don't see any option to specify an edge or other label for the tunnel.

Is this possible from the python api?

@bobzilladev
Copy link
Contributor

Hello, thanks for your question! There is a labels kwarg that can be used, here's an example:
ngrok.forward("localhost:8080", proto="labeled", labels="edge:edghts_2G...", authtoken_from_env=True)

We'll get the documentation updated to add it. Thanks again!

@jimkring
Copy link
Author

jimkring commented Jan 4, 2024

That's great it's already supported by the API!

A couple other points:

  1. I created a suggestion to make this a named parameter.

  2. It would probably make sense to add an option to the ngrok dashboard for creating a tunnel using the Python (Rust, Go, etc.) APIs, as described in the screenshot below:

2024-01-04_12-45-55

@jimkring
Copy link
Author

jimkring commented Jan 4, 2024

@bobzilladev another thought:

  1. The example you provided labels="edge:edghts_2G..." shows a truncated string. What's the format for passing multiple labels? e.g. is it a comma-delimited list like labels="key1:value1,key2:value2"?

@bobzilladev
Copy link
Contributor

Will try to answer these questions here:

  1. For a more concrete style the builder pattern configuration can be used, here's an example of that which is more explicit: ngrok-labeled.py
  2. Adding to the start a tunnel pane has been discussed, for now the python getting started page is a dashboard resource to help initial setup: dashboard.ngrok.com/get-started/setup/python
  3. The labels kwarg can take an array as well, labels=["key1:value1", "key2:value2"]

Hopefully that's useful, thanks for the feedback!

@jimkring
Copy link
Author

jimkring commented Jan 5, 2024

Yes, thanks!

@jimkring jimkring closed this as completed Jan 5, 2024
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

No branches or pull requests

2 participants