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

Ignore trailing slash in DSN #728

Closed
wants to merge 1 commit into from

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