Skip to content

Commit

Permalink
update server start output
Browse files Browse the repository at this point in the history
  • Loading branch information
joedixon committed Feb 20, 2024
1 parent 85fdf9f commit 2969700
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Certificate.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static function exists(string $url): bool
*/
public static function resolve(string $url): ?array
{
$host = parse_url($url, PHP_URL_HOST);
$host = parse_url($url, PHP_URL_HOST) ?: $url;
$certificate = $host.'.crt';
$key = $host.'.key';

Expand Down
2 changes: 1 addition & 1 deletion src/Servers/Reverb/Console/Commands/StartServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function handle(): void
$this->ensureRestartCommandIsRespected($server, $loop, $host, $port);
$this->ensurePulseEventsAreCollected($loop, $config['pulse_ingest_interval']);

$this->components->info("Starting server on {$host}:{$port}" . ($hostname ? " ({$hostname})" : ''));
$this->components->info("Starting " . ($server->isSecure() ? 'secure ' : ''). "server on {$host}:{$port}" . ($hostname ? " ({$hostname})" : ''));

$server->start();
}
Expand Down
9 changes: 9 additions & 0 deletions src/Servers/Reverb/Http/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laravel\Reverb\Servers\Reverb\Http;

use Illuminate\Support\Str;
use Laravel\Reverb\Servers\Reverb\Concerns\ClosesConnections;
use OverflowException;
use Psr\Http\Message\RequestInterface;
Expand Down Expand Up @@ -95,4 +96,12 @@ public function __invoke(ConnectionInterface $connection): void
$this->handleRequest($data, $connection);
});
}

/**
* Determine whether the server has TLS support.
*/
public function isSecure(): bool
{
return Str::startsWith($this->socket->getAddress(), 'tls://');
}
}

0 comments on commit 2969700

Please sign in to comment.