mirror of
https://github.com/getgrav/grav.git
synced 2026-05-07 22:06:43 +02:00
Added support for redis password option #1620
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
1. [](#improved)
|
||||
* Forced `natsort` on plugins to ensure consistent plugin load ordering across platforms [#1614](https://github.com/getgrav/grav/issues/1614)
|
||||
* Use new `multilevel` field to handle Asset Collections [#1201](https://github.com/getgrav/grav-plugin-admin/issues/1201)
|
||||
* Added support for redis `password` option [#1620](https://github.com/getgrav/grav/issues/1620)
|
||||
|
||||
# v1.3.2
|
||||
## 08/16/2017
|
||||
|
||||
@@ -616,6 +616,12 @@ form:
|
||||
help: PLUGIN_ADMIN.REDIS_PORT_HELP
|
||||
placeholder: "6379"
|
||||
|
||||
cache.redis.password:
|
||||
type: text
|
||||
size: small
|
||||
label: PLUGIN_ADMIN.REDIS_PASSWORD
|
||||
|
||||
|
||||
|
||||
twig:
|
||||
type: section
|
||||
|
||||
@@ -240,6 +240,7 @@ class Cache extends Getters
|
||||
case 'redis':
|
||||
$redis = new \Redis();
|
||||
$socket = $this->config->get('system.cache.redis.socket', false);
|
||||
$password = $this->config->get('system.cache.redis.password', false);
|
||||
|
||||
if ($socket) {
|
||||
$redis->connect($socket);
|
||||
@@ -248,6 +249,11 @@ class Cache extends Getters
|
||||
$this->config->get('system.cache.redis.port', 6379));
|
||||
}
|
||||
|
||||
// Authenticate with password if set
|
||||
if ($password && !$redis->auth($password)) {
|
||||
throw new \RedisException('Redis authentication failed');
|
||||
}
|
||||
|
||||
$driver = new DoctrineCache\RedisCache();
|
||||
$driver->setRedis($redis);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user