Added soft default to replication driver check

This commit is contained in:
Alex Renoki 2020-08-13 19:20:29 +03:00
parent 1446cf8610
commit 4389fd1360
2 changed files with 3 additions and 3 deletions

View File

@ -257,7 +257,7 @@ class RedisClient implements ReplicationInterface
*/
protected function getConnectionUri()
{
$name = config('websockets.replication.redis.connection') ?? 'default';
$name = config('websockets.replication.redis.connection') ?: 'default';
$config = config('database.redis')[$name];
$host = $config['host'];

View File

@ -57,13 +57,13 @@ class WebSocketsServiceProvider extends ServiceProvider
protected function configurePubSub()
{
if (config('websockets.replication.driver') === 'local') {
if (config('websockets.replication.driver', 'local') === 'local') {
$this->app->singleton(ReplicationInterface::class, function () {
return new LocalClient;
});
}
if (config('websockets.replication.driver') === 'redis') {
if (config('websockets.replication.driver', 'local') === 'redis') {
$this->app->singleton(ReplicationInterface::class, function () {
return (new RedisClient)->boot($this->loop ?? LoopFactory::create());
});