Allow specifying server host and port in share command

This commit is contained in:
Marcel Pociot
2020-12-07 23:30:57 +01:00
parent 7bfb618d93
commit 5b8cc4d985
2 changed files with 9 additions and 5 deletions

View File

@@ -45,7 +45,7 @@ class Client
$sharedUrl = $this->prepareSharedUrl($sharedUrl);
foreach ($subdomains as $subdomain) {
$this->connectToServer($sharedUrl, $subdomain, config('expose.auth_token'));
$this->connectToServer($sharedUrl, $subdomain, $this->configuration->auth());
}
}

View File

@@ -10,7 +10,7 @@ use Symfony\Component\Console\Output\ConsoleOutput;
class ShareCommand extends Command
{
protected $signature = 'share {host} {--subdomain=} {--auth=}';
protected $signature = 'share {host} {--subdomain=} {--auth=} {--server-host=} {--server-port=}';
protected $description = 'Share a local url with a remote expose server';
@@ -27,11 +27,15 @@ class ShareCommand extends Command
{
$this->configureConnectionLogger();
$serverHost = $this->option('server-host') ?? config('expose.host', 'localhost');
$serverPort = $this->option('server-port') ?? config('expose.port', 8080);
$auth = $this->option('auth') ?? config('expose.auth_token', '');
(new Factory())
->setLoop(app(LoopInterface::class))
->setHost(config('expose.host', 'localhost'))
->setPort(config('expose.port', 8080))
->setAuth($this->option('auth'))
->setHost($serverHost)
->setPort($serverPort)
->setAuth($auth)
->createClient()
->share($this->argument('host'), explode(',', $this->option('subdomain')))
->createHttpServer()