Skip to content

Commit

Permalink
Support nonProxyHosts for Vault client
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed May 25, 2021
1 parent 950286b commit 37604ad
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static WebClient createHttpClient(Vertx vertx, VaultBootstrapConfig vault
.setConnectTimeout((int) vaultBootstrapConfig.connectTimeout.toMillis())
.setIdleTimeout((int) vaultBootstrapConfig.readTimeout.getSeconds());

if (vaultBootstrapConfig.nonProxyHosts.isPresent()) {
options.setNonProxyHosts(vaultBootstrapConfig.nonProxyHosts.get());
}

boolean trustAll = vaultBootstrapConfig.tls.skipVerify.orElseGet(() -> tlsConfig.trustAll);
if (trustAll) {
skipVerify(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,17 @@ public class VaultBootstrapConfig {
@ConfigItem(defaultValue = DEFAULT_READ_TIMEOUT)
public Duration readTimeout;

/**
* List of remote hosts that are not proxied when the client is configured to use a proxy. This
* list serves the same purpose as the JVM {@code nonProxyHosts} configuration.
*
* <p>
* Entries can use the <i>*</i> wildcard character for pattern matching, e.g <i>*.example.com</i> matches
* <i>www.example.com</i>.
*/
@ConfigItem
public Optional<List<String>> nonProxyHosts;

/**
* List of named credentials providers, such as: `quarkus.vault.credentials-provider.foo.kv-path=mypath`
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ private VaultBootstrapConfig createConfig() {
config.authentication.userpass.passwordWrappingToken = Optional.empty();
config.connectTimeout = Duration.ofSeconds(1);
config.readTimeout = Duration.ofSeconds(1);
config.nonProxyHosts = Optional.empty();
config.tls.skipVerify = Optional.of(true);
config.logConfidentialityLevel = LogConfidentialityLevel.LOW;
config.renewGracePeriod = Duration.ofSeconds(3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ private VaultBootstrapConfig createConfig() {
config.authentication.userpass.passwordWrappingToken = Optional.empty();
config.connectTimeout = Duration.ofSeconds(1);
config.readTimeout = Duration.ofSeconds(1);
config.nonProxyHosts = Optional.empty();
config.tls.skipVerify = Optional.of(true);
config.logConfidentialityLevel = LogConfidentialityLevel.LOW;
config.renewGracePeriod = Duration.ofSeconds(3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ private TestVaultClient createVaultClient() {
vaultBootstrapConfig.tls.caCert = Optional.empty();
vaultBootstrapConfig.connectTimeout = Duration.ofSeconds(5);
vaultBootstrapConfig.readTimeout = Duration.ofSeconds(1);
vaultBootstrapConfig.nonProxyHosts = Optional.empty();
vaultBootstrapConfig.authentication = new VaultAuthenticationConfig();
vaultBootstrapConfig.authentication.kubernetes = new VaultKubernetesAuthenticationConfig();
return new TestVaultClient(new VaultConfigHolder().setVaultBootstrapConfig(vaultBootstrapConfig));
Expand Down

0 comments on commit 37604ad

Please sign in to comment.