From 2e94e9a52706741feb5a640221b753d8b1c5fec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Maisse?= Date: Wed, 24 May 2023 14:58:24 +0200 Subject: [PATCH] fix: add config to disable keystore watcher https://gravitee.atlassian.net/browse/APIM-305 https://github.com/gravitee-io/issues/issues/8644 --- .../node/vertx/AbstractVertxHttpServerFactory.java | 2 +- .../configuration/HttpServerConfiguration.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gravitee-node-vertx/src/main/java/io/gravitee/node/vertx/AbstractVertxHttpServerFactory.java b/gravitee-node-vertx/src/main/java/io/gravitee/node/vertx/AbstractVertxHttpServerFactory.java index 57e2a11d1..c2f3c6657 100644 --- a/gravitee-node-vertx/src/main/java/io/gravitee/node/vertx/AbstractVertxHttpServerFactory.java +++ b/gravitee-node-vertx/src/main/java/io/gravitee/node/vertx/AbstractVertxHttpServerFactory.java @@ -113,7 +113,7 @@ protected HttpServerOptions getHttpServerOptions() { .withKeyStoreType(httpServerConfiguration.getKeyStoreType()) .withKeyStoreCertificates(httpServerConfiguration.getKeyStoreCertificates()) .withKubernetesLocations(httpServerConfiguration.getKeystoreKubernetes()) - .withWatch(true) // TODO: allow to configure watch (globally, just for keystore, ...) ? + .withWatch(httpServerConfiguration.getKeyStoreWatch()) .withDefaultAlias(httpServerConfiguration.getKeyStoreDefaultAlias()) .build(); diff --git a/gravitee-node-vertx/src/main/java/io/gravitee/node/vertx/configuration/HttpServerConfiguration.java b/gravitee-node-vertx/src/main/java/io/gravitee/node/vertx/configuration/HttpServerConfiguration.java index b91c54cc6..604e39c80 100644 --- a/gravitee-node-vertx/src/main/java/io/gravitee/node/vertx/configuration/HttpServerConfiguration.java +++ b/gravitee-node-vertx/src/main/java/io/gravitee/node/vertx/configuration/HttpServerConfiguration.java @@ -56,6 +56,7 @@ public class HttpServerConfiguration { private final String tlsProtocols; private final String keyStorePath; private final List keyStoreKubernetes; + private final boolean keyStoreWatch; private final String keyStoreDefaultAlias; private final String keyStorePassword; private final String keyStoreType; @@ -95,6 +96,7 @@ private HttpServerConfiguration(HttpServerConfigurationBuilder builder) { this.tlsProtocols = builder.tlsProtocols; this.keyStorePath = builder.keyStorePath; this.keyStoreKubernetes = builder.keyStoreKubernetes; + this.keyStoreWatch = builder.keyStoreWatch; this.keyStoreDefaultAlias = builder.keyStoreDefaultAlias; this.keyStorePassword = builder.keyStorePassword; this.keyStoreType = builder.keyStoreType; @@ -172,6 +174,10 @@ public List getKeystoreKubernetes() { return keyStoreKubernetes; } + public boolean getKeyStoreWatch() { + return keyStoreWatch; + } + public String getKeyStoreDefaultAlias() { return this.keyStoreDefaultAlias; } @@ -291,6 +297,7 @@ public static class HttpServerConfigurationBuilder { private String tlsProtocols; private String keyStorePath; private List keyStoreKubernetes; + private boolean keyStoreWatch = true; private String keyStoreDefaultAlias; private String keyStorePassword; private String keyStoreType = CERTIFICATE_FORMAT_JKS; @@ -403,6 +410,11 @@ public HttpServerConfigurationBuilder withDefaultKeyStoreKubernetes(List return this; } + public HttpServerConfigurationBuilder withDefaultKeyStoreWatch(boolean keyStoreWatch) { + this.keyStoreWatch = keyStoreWatch; + return this; + } + public HttpServerConfigurationBuilder withDefaultKeyStorePassword(String keyStorePassword) { this.keyStorePassword = keyStorePassword; return this; @@ -623,6 +635,7 @@ public HttpServerConfiguration build() { this.keyStorePath = environment.getProperty(prefix + "ssl.keystore.path", keyStorePath); this.keyStoreCertificates = getCertificateValues(prefix + "ssl.keystore.certificates"); this.keyStoreKubernetes = getArrayValues(prefix + "ssl.keystore.kubernetes", this.keyStoreKubernetes); + this.keyStoreWatch = environment.getProperty(prefix + "ssl.keystore.watch", Boolean.class, this.keyStoreWatch); this.keyStoreDefaultAlias = environment.getProperty(prefix + "ssl.keystore.defaultAlias"); this.keyStorePassword = environment.getProperty(prefix + "ssl.keystore.password", keyStorePassword);