Skip to content

Commit 0544f51

Browse files
committed
Add Redis DB to config.yml and resolv #2
1 parent fb66cb9 commit 0544f51

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020

21-
define('STATUSENGINE_WORKER_VERSION', '3.0.0');
21+
define('STATUSENGINE_WORKER_VERSION', '3.1.0');
2222
define('DS', DIRECTORY_SEPARATOR);
2323

2424
require_once __DIR__ . DS . 'vendor' . DS . 'autoload.php';

etc/config.yml.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use_redis: 0
3434
redis:
3535
address: 127.0.0.1
3636
port: 6379
37+
db: 0
3738

3839
############
3940
# HISTORY DATA CONFIGURATION

src/Backends/Redis/Redis.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function connect() {
5353

5454
$config = $this->Config->getRedisConfig();
5555
$this->Redis->connect($config['address'], $config['port']);
56+
$this->Redis->select($config['db']);
5657
}
5758

5859
/**

src/Config.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ public function getGearmanConfig() {
241241
public function getRedisConfig() {
242242
$config = [
243243
'address' => '127.0.0.1',
244-
'port' => 6379
244+
'port' => 6379,
245+
'db' => 0
245246
];
246247

247248
if (isset($this->config['redis']['address'])) {
@@ -252,6 +253,10 @@ public function getRedisConfig() {
252253
$config['port'] = $this->config['redis']['port'];
253254
}
254255

256+
if (isset($this->config['redis']['db'])) {
257+
$config['db'] = (int)$this->config['redis']['db'];
258+
}
259+
255260
return $config;
256261
}
257262

0 commit comments

Comments
 (0)