Quarkus Redis client not accepting hostnames with underscores in it
See original GitHub issueDescribe the bug
This is a borderline bug, since, depending on where on the Internet you check, underscores are either not recommended or not allowed in hostnames.
The issue I am having is that I am running a Quarkus App in one Docker Swarm stack, which needs to connect to a Redis server in another stack. In the Docker Swarm world, with the service redis running in the stack redis, that means that my config would have to be
quarkus.redis.hosts=redis://redis_redis:6379
However, in io.quarkus.redis.client.runtime.RedisConfig.RedisConfiguration, the hosts are defined as a set of URIs
@ConfigItem(
defaultValueDocumentation = "redis://localhost:6379"
)
public Optional<Set<URI>> hosts;
and java.net.URI does not accept hostnames with underscores in them.
Expected behavior
The Redis client uses the Redis host name with underscores in it as defined in application.properties
Actual behavior
The Redis client defaults to using redis://localhost:6379
To Reproduce
Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).
Or attach an archive containing the reproducer to the issue.
Steps to reproduce the behavior:
- Start from the Redis quickstart, https://github.com/quarkusio/quarkus-quickstarts/tree/main/redis-quickstart
- Update application.properties with quarkus.redis.hosts=redis://redis_redis:6379
- Run application, it will connect to the default Redis hostname redis://localhost:6379
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (4 by maintainers)
I don’t think we can reasonably do something about this. Closing.
I think this is an issue of RFC/specs vs. reality. Agreed, the specs say no to underscores, but in reality it has become somewhat prevalent (but one could argue it is a bad design choice on the Docker Swarm side to generate hostnames like this).