1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-06 16:50:09 +01:00

added ngrok class

This commit is contained in:
Taylor Otwell
2016-05-09 13:46:07 -05:00
parent f6abc45223
commit 9d2245b015
3 changed files with 50 additions and 15 deletions

View File

@@ -14,6 +14,7 @@
use Valet\Facades\Brew;
use Valet\Facades\Site;
use Valet\Facades\Caddy;
use Valet\Facades\Ngrok;
use Valet\Facades\PhpFpm;
use Valet\Facades\DnsMasq;
use Valet\Facades\Filesystem;
@@ -164,21 +165,7 @@
* Echo the currently tunneled URL.
*/
$app->command('fetch-share-url', function () {
retry(20, function () {
$response = Httpful\Request::get('http://127.0.0.1:4040/api/tunnels')->send();
$body = $response->body;
if (isset($body->tunnels) && count($body->tunnels) > 0) {
foreach ($body->tunnels as $tunnel) {
if ($tunnel->proto == 'http') {
return output($tunnel->public_url);
}
}
}
throw new Exception("Tunnel not established.");
}, 250);
output(Ngrok::currentTunnelUrl());
});
/**