jn-jairo / laravel-ngrok

Share Laravel application with ngrok.
MIT License
89 stars 12 forks source link

The package doesn't allow for the setup of an ngrok auth token and doesn't handle errors if the token is not set #13

Closed sergx closed 1 year ago

sergx commented 1 year ago

Describe the bug I got error in console after php artisan ngrok loc-team.test: cURL error 7: Send failure: Connection was reset (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://127.0.0.1:4041/api/tunne

After some research i figured out, that this error appears because ngrok just did not started properly. And it's because it wanted me to set auth token (with command ngrok config add-authtoken).

The ngrok token you can get at https://dashboard.ngrok.com/get-started/setup

To solve the problem in the NgrokProcessBuilder.php file i added one line: $command = explode(" ", "ngrok config add-authtoken XXXXXXXXXXX"); before return new Process($command, $this->getWorkingDirectory(), null, null, null); And commented out if block with $tunnels = $webService->getTunnels(); in the NgrokCommand.php

This changes i made only for one request CLI command - php artisan ngrok

jn-jairo commented 1 year ago

The ngrok config command edits the configuration file, it should not be done every time when starting the tunnel, you must add your configurations using ngrok config or editing the configuration file manually before starting the tunnel, the ngrok will load the configurations from the default configuration file, or you can specify the configuration file using php artisan ngrok --extra='--config=ngrok.yml' loc-team.test.