Commit ade2dff5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

web: enable TLS transport for Redis connections

parent 5f095fae
...@@ -63,7 +63,8 @@ if (!is_string($nonce) || !is_string($proof) || time() > $expires || ...@@ -63,7 +63,8 @@ if (!is_string($nonce) || !is_string($proof) || time() > $expires ||
try { try {
$redis = new Redis(); $redis = new Redis();
if (!$redis->connect($host_redis, 6379, 2.5, null, 0, 0, $redis_tls ? ['stream' => ['verify_peer' => true]] : [])) { $redis_host = $redis_tls ? 'tls://' . $host_redis : $host_redis;
if (!$redis->connect($redis_host, 6379, 2.5, null, 0, 0, $redis_tls ? ['stream' => ['verify_peer' => true]] : [])) {
throw new RedisException('connection failed'); throw new RedisException('connection failed');
} }
if ($redis_password !== '' && !$redis->auth($redis_username !== '' ? [$redis_username, $redis_password] : $redis_password)) { if ($redis_password !== '' && !$redis->auth($redis_username !== '' ? [$redis_username, $redis_password] : $redis_password)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment