Added support for changing ngrok region #84
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recently, ngrok announced multiregion service to general availability, which allow users to change to a datacenter region closer to themselves.
The default region is the US, which may cause a high response time for developers in other regions. I live in Norway, and I'm getting around 400 to 500 ms response times according to the Chrome Devtools when using the default us region. When switching to the eu region, the response times drop to around 100 ms. A huge improvement!
This PR allows you to run the following command:
I'm not sure if I love this approach, but you may think of this as a proof of concept. Maybe some bash master could improve the code? I'm definitely open for suggestions.
Perhaps adding a new command like
valet region eu- which would set the region in some config file - would be better? This way you won't have to specify the region every time you want to share the site.Currently, the following regions are supported by ngrok:
Try it out:
Replace
site-namewith your project's directory name. If you're not using the default .dev domain, then replace that too.