Skip to content

Conversation

HypeMC
Copy link
Contributor

@HypeMC HypeMC commented Sep 12, 2024

Currently the DSN doesn't work if you have an optional db, eg:

snc_redis:
  clients:
    default:
      dsn: '%env(REDIS_DSN)%/%env(default::REDIS_DB)%'

@ostrolucky
Copy link
Collaborator

I'm sorry but this would be quite inconsistent with other projects. AFAIK no project is doing this. If you have optional database, you can either include it in DSN, or combine dsn with specific parameters like so

snc_redis:
  clients:
    default:
      dsn: '%env(REDIS_DSN)%'
      options:
        parameters:
          database: '%env(default::REDIS_DB)%'

@ostrolucky ostrolucky closed this Sep 12, 2024
@HypeMC
Copy link
Contributor Author

HypeMC commented Sep 12, 2024

@ostrolucky Actually, it works with eg Symfony's lock component:

framework:
  lock:
    resources:
      default: '%env(REDIS_DSN)%/%env(default::REDIS_DB)%'

In any case, there are some examples that need to be fixed then, eg https://github.com/snc/SncRedisBundle/tree/master/docs#usage-with-symfonyweb-profiler-bundle

@HypeMC HypeMC deleted the ignore-trailing-slash branch September 12, 2024 07:52
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.

2 participants