From 479e441d29c883292a2c828bbf7bb7fb0e6a56cd Mon Sep 17 00:00:00 2001 From: Holger Reinhardt Date: Wed, 3 Aug 2016 16:24:57 +0200 Subject: [PATCH] make it configurable which redis config to use --- config/resque.php | 11 ++++++++++- src/ResqueServiceProvider.php | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/config/resque.php b/config/resque.php index fa1ed30..dc96978 100644 --- a/config/resque.php +++ b/config/resque.php @@ -2,6 +2,15 @@ return [ + /* + |-------------------------------------------------------------------------- + | Default Redis Config + |-------------------------------------------------------------------------- + | + */ + + 'default' => env('RESQUE_REDIS', 'resque'), + /* |-------------------------------------------------------------------------- | Prefix @@ -9,6 +18,6 @@ return [ | */ - 'prefix' => env('RESQUE_PREFIX', 'resque'), + 'prefix' => 'lethe_' . env('APP_ID'), ]; diff --git a/src/ResqueServiceProvider.php b/src/ResqueServiceProvider.php index b8768de..87d0510 100644 --- a/src/ResqueServiceProvider.php +++ b/src/ResqueServiceProvider.php @@ -48,7 +48,11 @@ class ResqueServiceProvider extends ServiceProvider protected function setRedisConfig() { - $config = $this->app['config']['database.redis.default']; + $default = $this->app['config']['resque.default']; + $config = $this->app['config'][sprintf('database.redis.%s', $default)]; + if (!$config) { + $config = $this->app['config']['database.redis.default']; + } $host = isset($config['host']) ? $config['host'] : 'localhost'; $port = isset($config['port']) ? $config['port'] : 6379;