Added command line options for server-host and server-port (#147)

* Added server options

* Restored box.json

* Reverted build and versioning...

* Please the style gods
This commit is contained in:
Tii
2020-12-04 22:44:25 +01:00
committed by GitHub
parent c92d4b258c
commit bded9f754e
3 changed files with 11 additions and 7 deletions

View File

@@ -45,13 +45,13 @@ 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());
}
}
public function sharePort(int $port)
{
$this->connectToServerAndShareTcp($port, config('expose.auth_token'));
$this->connectToServerAndShareTcp($port, $this->configuration->auth());
}
protected function prepareSharedUrl(string $sharedUrl): string

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()

View File

@@ -4,7 +4,7 @@ namespace App\Commands;
class ShareCurrentWorkingDirectoryCommand extends ShareCommand
{
protected $signature = 'share-cwd {host?} {--subdomain=} {--auth=}';
protected $signature = 'share-cwd {host?} {--subdomain=} {--auth=} {--server-host=} {--server-port=}';
public function handle()
{