|
33 | 33 | import javax.validation.*; |
34 | 34 | import javax.validation.constraints.NotBlank; |
35 | 35 | import javax.validation.constraints.NotNull; |
| 36 | +import org.slf4j.Logger; |
36 | 37 |
|
37 | 38 | /** Feast Serving properties. */ |
38 | 39 | public class ApplicationProperties { |
| 40 | + private static final Logger log = org.slf4j.LoggerFactory.getLogger(ApplicationProperties.class); |
| 41 | + |
39 | 42 | public static class FeastProperties { |
40 | 43 | /* Feast Serving build version */ |
41 | 44 | @NotBlank private String version = "unknown"; |
@@ -246,10 +249,33 @@ public void setType(String type) { |
246 | 249 | * @return Returns the store specific configuration |
247 | 250 | */ |
248 | 251 | public RedisClusterStoreConfig getRedisClusterConfig() { |
| 252 | + String read_from; |
| 253 | + if (!this.config.containsKey("read_from") || this.config.get("read_from") == null) { |
| 254 | + log.info("'read_from' not defined in Redis cluster config, so setting to UPSTREAM"); |
| 255 | + read_from = ReadFrom.UPSTREAM.toString(); |
| 256 | + } else { |
| 257 | + read_from = this.config.get("read_from"); |
| 258 | + } |
| 259 | + |
| 260 | + if (!this.config.containsKey("timeout") || this.config.get("timeout") == null) { |
| 261 | + throw new IllegalArgumentException( |
| 262 | + "Redis cluster config does not have 'timeout' specified"); |
| 263 | + } |
| 264 | + |
| 265 | + Boolean ssl = null; |
| 266 | + if (!this.config.containsKey("ssl") || this.config.get("ssl") == null) { |
| 267 | + log.info("'ssl' not defined in Redis cluster config, so setting to false"); |
| 268 | + ssl = false; |
| 269 | + } else { |
| 270 | + ssl = Boolean.parseBoolean(this.config.get("ssl")); |
| 271 | + } |
| 272 | + Duration timeout = Duration.parse(this.config.get("timeout")); |
249 | 273 | return new RedisClusterStoreConfig( |
250 | 274 | this.config.get("connection_string"), |
251 | | - ReadFrom.valueOf(this.config.get("read_from")), |
252 | | - Duration.parse(this.config.get("timeout"))); |
| 275 | + ReadFrom.valueOf(read_from), |
| 276 | + timeout, |
| 277 | + ssl, |
| 278 | + this.config.getOrDefault("password", "")); |
253 | 279 | } |
254 | 280 |
|
255 | 281 | public RedisStoreConfig getRedisConfig() { |
|
0 commit comments