Skip to content

Commit da61480

Browse files
author
Dmitriy Dubson
committed
Adds support for Redis username, sentinel username and password fields
GH issue #84
1 parent d100e81 commit da61480

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Type: `redis`
232232
Disable Property: `org.springframework.cloud.bindings.boot.redis.enable`
233233

234234
| Property | Value |
235-
| ------------------------------------ | ------------------------- |
235+
|--------------------------------------|---------------------------|
236236
| `spring.redis.client-name` | `{client-name}` |
237237
| `spring.redis.cluster.max-redirects` | `{cluster.max-redirects}` |
238238
| `spring.redis.cluster.nodes` | `{cluster.nodes}` |
@@ -242,8 +242,11 @@ Disable Property: `org.springframework.cloud.bindings.boot.redis.enable`
242242
| `spring.redis.port` | `{port}` |
243243
| `spring.redis.sentinel.master` | `{sentinel.master}` |
244244
| `spring.redis.sentinel.nodes` | `{sentinel.nodes}` |
245+
| `spring.redis.sentinel.password` | `{sentinel.password}` |
246+
| `spring.redis.sentinel.username` | `{sentinel.username}` |
245247
| `spring.redis.ssl` | `{ssl}` |
246248
| `spring.redis.url` | `{url}` |
249+
| `spring.redis.username` | `{username}` |
247250

248251
### SAP Hana
249252
Type: `hana`

src/main/java/org/springframework/cloud/bindings/boot/RedisBindingsPropertiesProcessor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ public void process(Environment environment, Bindings bindings, Map<String, Obje
4949
map.from("database").to("spring.redis.database");
5050
map.from("host").to("spring.redis.host");
5151
map.from("password").to("spring.redis.password");
52+
map.from("username").to("spring.redis.username");
5253
map.from("port").to("spring.redis.port");
5354
map.from("sentinel.master").to("spring.redis.sentinel.master");
5455
map.from("sentinel.nodes").to("spring.redis.sentinel.nodes");
56+
map.from("sentinel.password").to("spring.redis.sentinel.password");
57+
map.from("sentinel.username").to("spring.redis.sentinel.username");
5558
map.from("ssl").to("spring.redis.ssl");
5659
map.from("url").to("spring.redis.url");
5760
});

src/test/java/org/springframework/cloud/bindings/boot/RedisBindingsPropertiesProcessorTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ final class RedisBindingsPropertiesProcessorTest {
4242
.withEntry("database", "test-database")
4343
.withEntry("host", "test-host")
4444
.withEntry("password", "test-password")
45+
.withEntry("username", "test-username")
4546
.withEntry("port", "test-port")
4647
.withEntry("sentinel.master", "test-sentinel-master")
4748
.withEntry("sentinel.nodes", "test-sentinel-nodes")
49+
.withEntry("sentinel.password", "test-sentinel-password")
50+
.withEntry("sentinel.username", "test-sentinel-username")
4851
.withEntry("ssl", "test-ssl")
4952
.withEntry("url", "test-url")
5053
)
@@ -65,9 +68,12 @@ void test() {
6568
.containsEntry("spring.redis.database", "test-database")
6669
.containsEntry("spring.redis.host", "test-host")
6770
.containsEntry("spring.redis.password", "test-password")
71+
.containsEntry("spring.redis.username", "test-username")
6872
.containsEntry("spring.redis.port", "test-port")
6973
.containsEntry("spring.redis.sentinel.master", "test-sentinel-master")
7074
.containsEntry("spring.redis.sentinel.nodes", "test-sentinel-nodes")
75+
.containsEntry("spring.redis.sentinel.password", "test-sentinel-password")
76+
.containsEntry("spring.redis.sentinel.username", "test-sentinel-username")
7177
.containsEntry("spring.redis.ssl", "test-ssl")
7278
.containsEntry("spring.redis.url", "test-url");
7379
}

0 commit comments

Comments
 (0)