Skip to content

feat: add the sync-ngrok command#218

Merged
eberle1080 merged 16 commits into
mainfrom
feat/ngrok-cmd
Jul 19, 2025
Merged

feat: add the sync-ngrok command#218
eberle1080 merged 16 commits into
mainfrom
feat/ngrok-cmd

Conversation

@eberle1080

@eberle1080 eberle1080 commented Jul 15, 2025

Copy link
Copy Markdown
Contributor

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

Copilot AI review requested due to automatic review settings July 15, 2025 00:52

This comment was marked as outdated.

@eberle1080 eberle1080 requested a review from Copilot July 15, 2025 02:26

This comment was marked as outdated.

@eberle1080 eberle1080 requested a review from Copilot July 15, 2025 02:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-ngrok subcommand 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) {

Comment thread cmd/sync_ngrok.go Outdated
Comment thread cmd/sync_ngrok.go
Comment thread cmd/sync_ngrok.go
@eberle1080 eberle1080 requested review from a team and jlimatampersand and removed request for a team July 15, 2025 04:11
@eberle1080 eberle1080 changed the title feat: add the ngrok command feat: add the sync-ngrok command Jul 15, 2025
eberle1080 and others added 16 commits July 19, 2025 11:24
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>
@eberle1080 eberle1080 enabled auto-merge (squash) July 19, 2025 18:29
@eberle1080 eberle1080 merged commit ded55b4 into main Jul 19, 2025
7 checks passed
@eberle1080 eberle1080 deleted the feat/ngrok-cmd branch July 19, 2025 18:29
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

Successfully merging this pull request may close these issues.

3 participants