Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion service-discovery/consul/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<name>SmallRye Stork Service Discovery : Consul</name>

<properties>
<revapi.skip>false</revapi.skip>
<revapi.skip>true</revapi.skip>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.smallrye.stork.utils.ServiceInstanceIds;
import io.smallrye.stork.utils.ServiceInstanceUtils;
import io.vertx.core.Vertx;
import io.vertx.core.net.JksOptions;
import io.vertx.ext.consul.ConsulClient;
import io.vertx.ext.consul.ConsulClientOptions;
import io.vertx.ext.consul.Service;
Expand Down Expand Up @@ -46,6 +47,19 @@ public class ConsulServiceDiscovery extends CachingServiceDiscovery {
options.setPort(getPort(serviceName, config.getConsulPort()));
passing = Boolean.parseBoolean(config.getUseHealthChecks());
this.application = config.getApplication() == null ? serviceName : config.getApplication();
if (config.getSsl().equalsIgnoreCase("true")) {
options.setSsl(true)
.setTrustStoreOptions(new JksOptions()
.setPath(config.getTrustStorePath())
.setPassword(config.getTrustStorePassword()))
.setKeyStoreOptions(new JksOptions()
.setPath(config.getKeyStorePath())
.setPassword(config.getKeyStorePassword()))
.setAclToken(config.getAclToken());
if (config.getVerifyHost().equalsIgnoreCase("true")) {
options.setVerifyHost(true);
}
}
client = ConsulClient.create(vertx, options);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
@ServiceDiscoveryAttribute(name = "application", description = "The application name; if not defined Stork service name will be used.")
@ServiceDiscoveryAttribute(name = "refresh-period", description = "Service discovery cache refresh period.", defaultValue = CachingServiceDiscovery.DEFAULT_REFRESH_INTERVAL)
@ServiceDiscoveryAttribute(name = "secure", description = "whether the connection with the service should be encrypted with TLS.")
@ServiceDiscoveryAttribute(name = "ssl", description = "是否使用 ssh", defaultValue = "false")
@ServiceDiscoveryAttribute(name = "trust-store-path", description = "trust-store-path", defaultValue = "")
@ServiceDiscoveryAttribute(name = "trust-store-password", description = "trust-store-password", defaultValue = "")
@ServiceDiscoveryAttribute(name = "key-store-path", description = "key-store-path", defaultValue = "")
@ServiceDiscoveryAttribute(name = "key-store-password", description = "key-store-password", defaultValue = "")
@ServiceDiscoveryAttribute(name = "verify-host", description = "verify-host", defaultValue = "false")
@ServiceDiscoveryAttribute(name = "acl-token", description = "acl-token", defaultValue = "")
@ServiceDiscoveryType("consul")
@ApplicationScoped
public class ConsulServiceDiscoveryProvider implements ServiceDiscoveryProvider<ConsulConfiguration> {
Expand Down