mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
Allow overriding DNS server. Set DNS if internal docker host is being shared
This commit is contained in:
@@ -142,7 +142,7 @@ class Factory
|
||||
|
||||
config()->set('expose.dashboard_port', $dashboardPort);
|
||||
|
||||
$this->app = new App('127.0.0.1', $dashboardPort, '0.0.0.0', $this->loop);
|
||||
$this->app = new App('0.0.0.0', $dashboardPort, '0.0.0.0', $this->loop);
|
||||
|
||||
$this->addRoutes();
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class HttpClient
|
||||
protected function createConnector(): Connector
|
||||
{
|
||||
return new Connector($this->loop, [
|
||||
'dns' => '127.0.0.1',
|
||||
'dns' => config('expose.dns', '127.0.0.1'),
|
||||
'tls' => [
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -29,6 +29,18 @@ return [
|
||||
*/
|
||||
'port' => 443,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DNS
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The DNS server to use when resolving the shared URLs.
|
||||
| When Expose is running from within Docker containers, you should set this to
|
||||
| `true` to fall-back to the system default DNS servers.
|
||||
|
|
||||
*/
|
||||
'dns' => '127.0.0.1',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Auth Token
|
||||
|
||||
Reference in New Issue
Block a user