Skip to content

feat(predis): support json:/csv: env processors for DSN arrays#3

Closed
guillaumedelre wants to merge 1 commit into
masterfrom
feat/predis-json-env-dsn
Closed

feat(predis): support json:/csv: env processors for DSN arrays#3
guillaumedelre wants to merge 1 commit into
masterfrom
feat/predis-json-env-dsn

Conversation

@guillaumedelre
Copy link
Copy Markdown
Owner

Summary

  • Add PredisParametersFactory::createFromDsns() accepting string|array to handle DSNs resolved at runtime by Symfony env processors
  • SncRedisExtension now uses createFromDsns (instead of create) when the DSN is a RedisEnvDsn, so that %env(json:REDIS_DSNS)% or %env(csv:REDIS_DSNS)% resolve correctly at runtime
  • Handles nested-array edge case ([['redis://host1', 'redis://host2']]) produced when a json: processor wraps a csv: result

Motivation

Fixes snc#483. Using %env(json:REDIS_DSNS)% as a predis DSN caused a TypeError at runtime because PredisParametersFactory::create() expects string $dsn but Symfony's json: env processor resolves to an array.

Test plan

  • PredisParametersFactoryTest: 4 new cases covering createFromDsns with string, single-element array, multiple DSNs, and nested array
  • SncRedisExtensionEnvTest: new testPredisJsonEnvDsn fixture + updated factory assertions for existing env tests
  • PHPCS clean, Psalm 0 errors on changed files

Add PredisParametersFactory::createFromDsns() that accepts string|array
and handles the nested-array produced by Symfony's json:/csv: env
processors. SncRedisExtension now uses createFromDsns for RedisEnvDsn
connections so that %env(json:REDIS_DSNS)% resolves correctly at runtime.

Signed-off-by: Guillaume Delré <delre.guillaume@gmail.com>
@guillaumedelre
Copy link
Copy Markdown
Owner Author

Superseded by snc#759.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

predis cluster support environment variables

1 participant