@@ -32,6 +32,8 @@ public class VaultConfigSource implements ConfigSource {
3232
3333 private static final EnvironmentLoader ENVIRONMENT_LOADER = new EnvironmentLoader ();
3434
35+ private static final String PATHS_SEPARATOR = ":" ;
36+
3537 private final VaultInvoker vault ;
3638 private final List <String > secretsPaths ;
3739
@@ -73,13 +75,17 @@ public static final class Builder {
7375 private List <String > secretsPaths =
7476 Optional .ofNullable (ENVIRONMENT_LOADER .loadVariable ("VAULT_SECRETS_PATH" ))
7577 .or (() -> Optional .ofNullable (ENVIRONMENT_LOADER .loadVariable ("VAULT_SECRETS_PATHS" )))
76- .map (s -> s .split (":" ))
78+ .map (s -> s .split (PATHS_SEPARATOR ))
7779 .map (Arrays ::asList )
7880 .orElseGet (ArrayList ::new );
7981
8082 private Builder () {}
8183
8284 /**
85+ * Appends {@code secretsPath} to {@code secretsPaths}.
86+ *
87+ * @param secretsPath secretsPath (may contain value with paths separated by {@code :})
88+ * @return this builder
8389 * @deprecated will be removed in future releases without notice, use {@link
8490 * #addSecretsPath(String...)} or {@link #secretsPaths(Collection)}.
8591 */
@@ -89,19 +95,33 @@ public Builder secretsPath(String secretsPath) {
8995 return this ;
9096 }
9197
98+ /**
99+ * Appends one or several secretsPath\es to {@code secretsPaths}.
100+ *
101+ * @param secretsPath one or several secretsPath\es (each value may contain paths separated by
102+ * {@code :})
103+ * @return this builder
104+ */
92105 public Builder addSecretsPath (String ... secretsPath ) {
93106 this .secretsPaths .addAll (toSecretsPaths (Arrays .asList (secretsPath )));
94107 return this ;
95108 }
96109
110+ /**
111+ * Setter for {@code secretsPaths}.
112+ *
113+ * @param secretsPaths collection of secretsPath\es (each value may contain paths separated by
114+ * {@code :})
115+ * @return this builder
116+ */
97117 public Builder secretsPaths (Collection <String > secretsPaths ) {
98118 this .secretsPaths = toSecretsPaths (secretsPaths );
99119 return this ;
100120 }
101121
102122 private static List <String > toSecretsPaths (Collection <String > secretsPaths ) {
103123 return secretsPaths .stream ()
104- .flatMap (s -> Arrays .stream (s .split (":" )))
124+ .flatMap (s -> Arrays .stream (s .split (PATHS_SEPARATOR )))
105125 .distinct ()
106126 .collect (Collectors .toList ());
107127 }
0 commit comments