Skip to content

Commit c97d805

Browse files
Merge pull request #99 from BetterCloud/expose-environmentloader
Gives VaultConfig the ability to disable loading from environment var…
2 parents bb1ae7d + 4989fb6 commit c97d805

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ should represent non-breaking changes. The third number represents any very min
230230
* Allows auth backend methods to be configured for non-default mount points.
231231
* Adds "revoke-self" capability for auth tokens.
232232
* Support for signing a new certificate based on a CSR (i.e. the `/v1/pki/sign` endpoint).
233+
* Gives `VaultConfig` the ability to disable loading from environment variables if desired.
233234
* Cleans up issues with the new Docker-based integration test suite.
234235
* Updates all dependencies to their latest versions (including switching to Vault 0.9.1 for integration testing).
235236

src/main/java/com/bettercloud/vault/VaultConfig.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,19 @@ public class VaultConfig implements Serializable {
4343
* <p>The code used to load environment variables is encapsulated here, so that a mock version of that environment
4444
* loader can be used by unit tests.</p>
4545
*
46-
* <p>This method is used by unit tests, to inject a mock environment variable when constructing a
47-
* <code>VaultConfig</code> instance using the builder pattern approach rather than the convenience constructor.
48-
* There really shouldn't ever be a need to call this method outside of a unit test context (hence the
49-
* <code>protected</code> access level).</p>
46+
* <p>This method is primarily intended for use by unit tests, to inject a mock environment variable when
47+
* constructing a <code>VaultConfig</code> instance using the builder pattern approach rather than the convenience
48+
* constructor. This method's access level was therefore originally set to <code>protected</code>, but was bumped
49+
* up to <code>public</code> due to community request for the ability to disable environment loading altogether
50+
* (see https://github.com/BetterCloud/vault-java-driver/issues/77).
51+
*
52+
* Note that if you do override this, however, then obviously all of the environment checking discussed in the
53+
* documentation becomes disabled.
5054
*
5155
* @param environmentLoader An environment variable loader implementation (presumably a mock)
5256
* @return This object, with environmentLoader populated, ready for additional builder-pattern method calls or else finalization with the build() method
5357
*/
54-
protected VaultConfig environmentLoader(final EnvironmentLoader environmentLoader) {
58+
public VaultConfig environmentLoader(final EnvironmentLoader environmentLoader) {
5559
this.environmentLoader = environmentLoader;
5660
return this;
5761
}

0 commit comments

Comments
 (0)