Skip to content

Commit

Permalink
feat: Add ability to specify password for the redis server
Browse files Browse the repository at this point in the history
  • Loading branch information
gurustephen committed Oct 10, 2024
1 parent f85a62d commit 0aefb24
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public function __construct($baseUri, $sdkKey, $options)
$this->_redisOptions = [
"timeout" => $options['redis_timeout'] ?? 5,
"host" => $options['redis_host'] ?? 'localhost',
"port" => $options['redis_port'] ?? 6379
"port" => $options['redis_port'] ?? 6379,
"password" => $options['redis_password'] ?? null
];
}
}
Expand Down Expand Up @@ -65,6 +66,12 @@ protected function getConnection()
$this->_redisOptions["timeout"],
'launchdarkly/php-server-sdk-redis-phpredis'
);
if (
$this->_redisOptions['password'] !== null &&
$this->_redisOptions['password' !== '']
) {
$redis->auth($this->_redisOptions['password']);
}
return $this->_redisInstance = $redis;
}
}
1 change: 1 addition & 0 deletions src/LaunchDarkly/Integrations/PHPRedis.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class PHPRedis
* @param array $options Configuration settings (can also be passed in the main client configuration):
* - `redis_host`: hostname of the Redis server; defaults to `localhost`
* - `redis_port`: port of the Redis server; defaults to 6379
* - `redis_password`: password to auth against the Redis server; optional
* - `redis_timeout`: connection timeout in seconds; defaults to 5
* - `redis_prefix`: a string to be prepended to all database keys; corresponds to the prefix
* setting in ld-relay
Expand Down

0 comments on commit 0aefb24

Please sign in to comment.