feat: add the sync-ngrok command#218
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds a hidden CLI command sync-ngrok that waits for a local ngrok instance, fetches its public URL, and updates specified Ampersand webhook destinations to use the ngrok tunnel.
- Introduces
sync-ngroksubcommand with flags for destinations, ngrok server, protocol, and confirmation. - Implements retry/backoff logic to wait for ngrok and fetch tunnel URLs (with interactive selection).
- Adds logic to merge ngrok URLs into existing webhook destinations and apply updates via the API.
Comments suppressed due to low confidence (1)
cmd/sync_ngrok.go:567
- [nitpick] The URL merging logic has several edge cases (paths, queries, fragments). Consider adding unit tests for mergeURLs to verify correct behavior across various input combinations.
func mergeURLs(ngrokURL, existingURL string) (string, error) {
jlimatampersand
approved these changes
Jul 16, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
11563ee to
f822ad2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds a new command, "sync-ngrok". It will wait for ngrok to be running, figure out what the public URL is, and update one or more Ampersand destinations to point to the ngrok URL (that is, it will swap out the domain - the path will be preserved).
I did this because I got tired of updating destinations by hand every time I had to re-run ngrok for local testing.
20250714194552124.mp4