Added soft default to replication driver check
This commit is contained in:
parent
1446cf8610
commit
4389fd1360
|
|
@ -257,7 +257,7 @@ class RedisClient implements ReplicationInterface
|
||||||
*/
|
*/
|
||||||
protected function getConnectionUri()
|
protected function getConnectionUri()
|
||||||
{
|
{
|
||||||
$name = config('websockets.replication.redis.connection') ?? 'default';
|
$name = config('websockets.replication.redis.connection') ?: 'default';
|
||||||
$config = config('database.redis')[$name];
|
$config = config('database.redis')[$name];
|
||||||
|
|
||||||
$host = $config['host'];
|
$host = $config['host'];
|
||||||
|
|
|
||||||
|
|
@ -57,13 +57,13 @@ class WebSocketsServiceProvider extends ServiceProvider
|
||||||
|
|
||||||
protected function configurePubSub()
|
protected function configurePubSub()
|
||||||
{
|
{
|
||||||
if (config('websockets.replication.driver') === 'local') {
|
if (config('websockets.replication.driver', 'local') === 'local') {
|
||||||
$this->app->singleton(ReplicationInterface::class, function () {
|
$this->app->singleton(ReplicationInterface::class, function () {
|
||||||
return new LocalClient;
|
return new LocalClient;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config('websockets.replication.driver') === 'redis') {
|
if (config('websockets.replication.driver', 'local') === 'redis') {
|
||||||
$this->app->singleton(ReplicationInterface::class, function () {
|
$this->app->singleton(ReplicationInterface::class, function () {
|
||||||
return (new RedisClient)->boot($this->loop ?? LoopFactory::create());
|
return (new RedisClient)->boot($this->loop ?? LoopFactory::create());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue