From 781c8d24624e3e223d864d472927fdb03609315f Mon Sep 17 00:00:00 2001 From: Holger Reinhardt Date: Mon, 1 Aug 2016 10:49:21 +0200 Subject: [PATCH] use dsn to connect to redis --- src/ResqueServiceProvider.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ResqueServiceProvider.php b/src/ResqueServiceProvider.php index 5629c44..69c0efa 100644 --- a/src/ResqueServiceProvider.php +++ b/src/ResqueServiceProvider.php @@ -53,9 +53,15 @@ class ResqueServiceProvider extends ServiceProvider $host = isset($config['host']) ? $config['host'] : 'localhost'; $port = isset($config['port']) ? $config['port'] : 6379; $database = isset($config['database']) ? $config['database'] : 0; + $password = isset($config['password']) ? $config['password'] : ''; $server = implode(':', [$host, $port]); + if ($password) { + $server = implode('@', [$password, $server]); + } - \Resque::setBackend($server, $database); + $dsn = sprintf('redis://%s/%s', $server, $database); + + \Resque::setBackend($dsn); } }