vert-x3 / vertx-config

Vert.x Configuration Service
Apache License 2.0
54 stars 64 forks source link

Config retriever doesn't get config for spring-cloud-config with HTTPS #149

Open minhaj86 opened 2 years ago

minhaj86 commented 2 years ago

Questions

Vertx config retriever does not work with spring-cloud-config server with HTTPS even if the spring-cloud-config server is configured with proper certificate (not self signed) . Underlying exception says "Connection closed"

Sample code:

    ConfigStoreOptions springCloudStore =
            new ConfigStoreOptions()
                    .setType("spring-config-server")
                    .setConfig(
                            new JsonObject()
                                    .put("url", String.format("https://some-cloud-config-server.com/application/profile", profile))
                                    .put("ssl", true)
                                    .put("timeout", 60000)
                                    .put("user", "dummy-user")
                                    .put("password", "secret")
                    );

    ConfigRetriever retriever =
            ConfigRetriever.create(
                    vertx,
                    new ConfigRetrieverOptions()
                            .addStore(springCloudStore)
            );
    retriever.getConfig(json -> {
        if (json.failed()) {
            log.error("failed to retrieve config {}", json.cause().getMessage());
            return;
        }

Version

4.3.3

gaol commented 2 years ago

According to https://vertx.io/docs/vertx-config/java/#_spring_config_server_store, you need to configure SSL/TLS set up in httpClientConfiguration of your configuration.

And I don't see any trustOptions set up in your code? do you have the peer certificate installed in your JDK?

minhaj86 commented 2 years ago

Tried with httpClientConfiguration, something like this:

.setConfig(new JsonObject() .put("url", url) .put("timeout", 60000L) .put("httpClientConfiguration", new JsonObject() .put("trustAll", true) .put("ssl", true)));

But still doesn't work.

minhaj86 commented 2 years ago

Any update on this?

gaol commented 2 years ago

A reproducer would be helpful to identity the issue. the exception stack trace etc.