From 182ac87ded2fa59be46263ea4043c58bbf440499 Mon Sep 17 00:00:00 2001 From: Eoin Gallinagh Date: Fri, 18 Feb 2022 10:48:41 +0000 Subject: [PATCH] Add redis host provider documentation. --- docs/src/main/asciidoc/redis.adoc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/docs/src/main/asciidoc/redis.adoc b/docs/src/main/asciidoc/redis.adoc index 7eb7dbf6afd62..61c9e4ec31179 100644 --- a/docs/src/main/asciidoc/redis.adoc +++ b/docs/src/main/asciidoc/redis.adoc @@ -569,6 +569,35 @@ RedisClient redisClient2; ReactiveRedisClient reactiveClient2; ---- +=== Providing Redis Hosts Programmatically + +The `RedisHostsProvider` programmatically provides redis hosts. This allows for configuration of properties like redis connection password coming from other sources. + +[NOTE] +==== +This is useful as it removes the need to store sensitive data in application.properties. +==== + +[source,java,indent=0] +---- +@ApplicationScoped +@Named("hosts-provider") // the name of the host provider +public class ExampleRedisHostProvider implements RedisHostsProvider { + @Override + public Set getHosts() { + // do stuff to get the host + String host = "redis://localhost:6379/3" + return Collections.singleton(URI.create(host)); + } +} +---- + +The host provider can be used to configure the redis client like shown below +[source,properties,indent=0] +---- +quarkus.redis.hosts-provider-name=hosts-provider +---- + === Creating Clients Programmatically The `RedisClient` and `ReactiveRedisClient` provide factory methods to create clients programmatically.