From 40efd8bf33b1a1beca5f879880fb61ed4c8f2710 Mon Sep 17 00:00:00 2001 From: Mariano Fernandez Date: Mon, 21 Mar 2022 22:42:39 +0100 Subject: [PATCH] fix(vertx-node): use default values for array HttpServerConfiguraiton properties --- .../configuration/HttpServerConfiguration.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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 93f0ee857..3086cb4ae 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 @@ -598,7 +598,10 @@ private List getCertificateValues(String prefix) { return certificates; } - private List getArrayValues(String prefix) { + private List getArrayValues( + String prefix, + List defaultValue + ) { final List values = new ArrayList<>(); boolean found = true; @@ -621,6 +624,10 @@ private List getArrayValues(String prefix) { } } + if (values.isEmpty() && defaultValue != null) { + return defaultValue; + } + return values; } @@ -689,7 +696,10 @@ public HttpServerConfiguration build() { this.keyStoreCertificates = getCertificateValues(prefix + "ssl.keystore.certificates"); this.keyStoreKubernetes = - getArrayValues(prefix + "ssl.keystore.kubernetes"); + getArrayValues( + prefix + "ssl.keystore.kubernetes", + this.keyStoreKubernetes + ); this.keyStoreDefaultAlias = environment.getProperty(prefix + "ssl.keystore.defaultAlias"); this.keyStorePassword = @@ -702,7 +712,8 @@ public HttpServerConfiguration build() { environment.getProperty(prefix + "ssl.truststore.type", trustStoreType); this.trustStorePath = environment.getProperty(prefix + "ssl.truststore.path", trustStorePath); - this.trustStorePaths = getArrayValues(prefix + "ssl.truststore.path"); + this.trustStorePaths = + getArrayValues(prefix + "ssl.truststore.path", this.trustStorePaths); this.trustStorePassword = environment.getProperty( prefix + "ssl.truststore.password",