Allow overriding DNS server. Set DNS if internal docker host is being shared

This commit is contained in:
Marcel Pociot
2021-03-02 16:39:51 +01:00
parent 986428fe00
commit 5c141986fe
4 changed files with 23 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ use Symfony\Component\Console\Output\ConsoleOutput;
class ShareCommand extends Command
{
protected $signature = 'share {host} {--subdomain=} {--auth=} {--server-host=} {--server-port=}';
protected $signature = 'share {host} {--subdomain=} {--auth=} {--server-host=} {--server-port=} {--dns=}';
protected $description = 'Share a local url with a remote expose server';
@@ -31,6 +31,14 @@ class ShareCommand extends Command
$serverPort = $this->option('server-port') ?? config('expose.port', 8080);
$auth = $this->option('auth') ?? config('expose.auth_token', '');
if (strstr($this->argument('host'), 'host.docker.internal')) {
config(['expose.dns' => true]);
}
if ($this->option('dns') !== null) {
config(['expose.dns' => empty($this->option('dns')) ? true : $this->option('dns')]);
}
(new Factory())
->setLoop(app(LoopInterface::class))
->setHost($serverHost)