Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

predis cluster support environment variables #483

Open
mSprunskas opened this issue Dec 20, 2018 · 4 comments
Open

predis cluster support environment variables #483

mSprunskas opened this issue Dec 20, 2018 · 4 comments
Labels
clustering Related to Redis clustering dx Developer eXperience enhancement Improves existing functionality predis Specific to Predis

Comments

@mSprunskas
Copy link

SncRedis config does not support env variables of "json" type, at least for dsn property.
Example .env

REDIS_SENTINELS="[\"redis://redis-sentinel1.dev:26379\", \"redis://redis-sentinel2.dev:26379\", \"redis://redis-sentinel3.dev:26379\"]"

Example config

snc_redis:
    clients:
        default:
            type: predis
            alias: default
            dsn: '%env(json:REDIS_SENTINELS)%'

PHP warnings

PHP Warning:  strrpos() expects parameter 1 to be string, array given in /home/app/src/vendor/snc/redis-bundle/DependencyInjection/Configuration/RedisDsn.php on line 172
PHP Warning:  preg_match() expects parameter 2 to be string, array given in /home/app/src/vendor/snc/redis-bundle/DependencyInjection/Configuration/RedisDsn.php on line 185
PHP Warning:  preg_match() expects parameter 2 to be string, array given in /home/app/src/vendor/snc/redis-bundle/DependencyInjection/Configuration/RedisDsn.php on line 190
PHP Warning:  preg_match() expects parameter 2 to be string, array given in /home/app/src/vendor/snc/redis-bundle/DependencyInjection/Configuration/RedisDsn.php on line 203
PHP Warning:  strpos() expects parameter 1 to be string, array given in /home/app/src/vendor/snc/redis-bundle/DependencyInjection/Configuration/RedisDsn.php on line 212

JSON support would simplify SncRedis config as sentinel dsn count may differ in different enviroments.

@curry684 curry684 added dx Developer eXperience enhancement Improves existing functionality labels Dec 28, 2018
@curry684
Copy link
Collaborator

curry684 commented Dec 28, 2018

It should be noted that support for advanced environment variables was added in Symfony 3.4 and currently this bundle still supports 2.x.

@codegain
Copy link

codegain commented Dec 10, 2019

Is there any chance this could be implemented soon? Currently I have to use multiple environment variables like this:

dsn:
    - 'redis://%env(REDIS_SERVER_1)%'
    - 'redis://%env(REDIS_SERVER_2)%'
    - 'redis://%env(REDIS_SERVER_3)%'

@B-Galati
Copy link
Collaborator

@codegain Feel free to send a PR, I will be happy to review it.

@ostrolucky ostrolucky added the predis Specific to Predis label Dec 17, 2021
@ostrolucky ostrolucky changed the title SncRedis support for json environment variable type predis support for json environment variable type Dec 17, 2021
@ostrolucky ostrolucky changed the title predis support for json environment variable type predis cluster support environment variables Dec 17, 2021
@ostrolucky ostrolucky added the clustering Related to Redis clustering label Dec 17, 2021
@ostrolucky
Copy link
Collaborator

For phpredis at least, this is supported since #594

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clustering Related to Redis clustering dx Developer eXperience enhancement Improves existing functionality predis Specific to Predis
Projects
None yet
Development

No branches or pull requests

5 participants