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

password is not passed #304

Open
rost5000 opened this issue Jun 8, 2022 · 4 comments
Open

password is not passed #304

rost5000 opened this issue Jun 8, 2022 · 4 comments

Comments

@rost5000
Copy link

rost5000 commented Jun 8, 2022

Expected Behavior

Class AbstractRedisClientFactory has the method public RedisClient redisClient(AbstractRedisConfiguration config, @Nullable ClientResources optionalClientResources, @Nullable List<ClientResourcesMutator> mutators) { //... . The method have the following expression: Optional<RedisURI> uri = config.getUri(); The problem is that password is not copied, when I configured in application.yaml For example:

redis:
  uri: redis://localhost
  password: bla-bla

So I receive error: io.lettuce.core.RedisCommandExecutionException: NOAUTH Authentication required.

Actual Behaviour

I expect that config.getUri(); return the password writed in application.yaml

Steps To Reproduce

  1. Clone https://github.com/rost5000/demo-lettuce-micronaut-bug
  2. Run docker-compose up -d
  3. Run micronaut application
  4. Go to http://localhost:8080/health
  5. You can see the following string in console: My Password from application.yaml: null. It is not expected password that I wrote.

Environment Information

  • Windows 10
  • Jdk 17 graalvm

Example Application

https://github.com/rost5000/demo-lettuce-micronaut-bug

Version

v3.5.1

@graemerocher
Copy link
Contributor

it is my understanding that the password has to be included as part of the Redis URI. See https://lettuce.io/core/release/api/io/lettuce/core/RedisURI.html for the syntax

@rost5000
Copy link
Author

@graemerocher graemerocher, Yes its true, however, considering the documentation: https://lettuce.io/core/release/reference/#connecting-redis I can use separately password and URL. Does Micronaut-Redis support that feauter?

Now I should replace bean in micronaut by this:

    @Bean
    @Replaces
    @Primary
    public RedisClient redisClient(AbstractRedisConfiguration configuration) {
        return RedisClient.create(configuration);
    }

Information about password is set in AbstractRedisConfiguration when I set like this

@dev2007
Copy link

dev2007 commented Apr 10, 2023

@graemerocher The document just said:You can customize the Redis configuration using any properties exposed by the DefaultRedisConfiguration class.
And the password is the public property(though it's deprecated.).
Maybe,as a habit of many developers,we should support the password property?

@aseychell
Copy link

Are there any updates on this issue, please? It still seems not possible to specify the password separate from the URI.

Since we are running the application in Kubernetes, I would like to specify the password from a Kubernetes Secret and it's available as an environment variable. If it has to be passed as part of the RedisURI in the application.yml, which is also a separate environment variable, it's not easy to combine these in the YAML file.

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

No branches or pull requests

4 participants