Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] [Redis] Make auth option works #42067

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

Merged
merged 1 commit into from
Jul 13, 2021
Merged

Conversation

welcoMattic
Copy link
Member

@welcoMattic welcoMattic commented Jul 12, 2021

Q A
Branch? 5.3
Bug fix? yes
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

Considering this configuration:

framework:
    messenger:
        transports:
            queue:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    stream: 'cms'
                    delete_after_ack: false
                    auth: 'pa$$word'
                    serializer: !php/const Redis::SERIALIZER_JSON

It results to this error:

In Connection.php line 510:

  NOAUTH Authentication required.

Because the auth option was never read from the options, only from the parsed DSN.

This fix allows users to use auth option from the configuration.

I target 5.3, as 5.2 is going to be unmaintained at the end of July

@chalasr
Copy link
Member

chalasr commented Jul 12, 2021

A test case would be nice to prevent regressions

@welcoMattic
Copy link
Member Author

welcoMattic commented Jul 12, 2021

@chalasr Sure, I'm on it. I will push it later today

EDIT: sorry for the messy rebase on 5.3

@welcoMattic welcoMattic changed the base branch from 5.4 to 5.2 July 13, 2021 04:52
@welcoMattic welcoMattic changed the base branch from 5.2 to 5.4 July 13, 2021 04:53
@welcoMattic welcoMattic requested a review from jderusse as a code owner July 13, 2021 04:56
@welcoMattic welcoMattic changed the base branch from 5.4 to 5.3 July 13, 2021 04:57
@welcoMattic welcoMattic requested a review from OskarStark as a code owner July 13, 2021 04:57
@welcoMattic welcoMattic changed the base branch from 5.3 to 5.4 July 13, 2021 04:57
@welcoMattic welcoMattic changed the base branch from 5.4 to 5.3 July 13, 2021 05:00
@welcoMattic
Copy link
Member Author

welcoMattic commented Jul 13, 2021

As documentation mention "Options defined under options take precedence over ones defined in the DSN." (https://symfony.com/doc/current/messenger.html#transport-configuration), I've updated the code to respect that. Also, I've added test to assert that put the auth value at user or password place in the DSN doesn't matter.

@chalasr chalasr added this to the 5.2 milestone Jul 13, 2021
@chalasr chalasr changed the base branch from 5.3 to 5.2 July 13, 2021 07:24
@chalasr
Copy link
Member

chalasr commented Jul 13, 2021

Good catch, thanks @welcoMattic.

@chalasr chalasr merged commit 6c26499 into symfony:5.2 Jul 13, 2021
@chalasr
Copy link
Member

chalasr commented Jul 13, 2021

Merged on 5.2 as this is a quick win and we didn't discuss about freezing 5.2 yet.

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

Successfully merging this pull request may close these issues.

4 participants