micronaut-redis
micronaut-redis copied to clipboard
password is not passed
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
- Clone https://github.com/rost5000/demo-lettuce-micronaut-bug
- Run
docker-compose up -d
- Run micronaut application
- Go to http://localhost:8080/health
- 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
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
@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
@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?
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.