Search in sources :

Example 1 with ConsulConfig

use of com.couchbase.connector.config.common.ConsulConfig in project couchbase-elasticsearch-connector by couchbase.

the class PauseCommand method consulBuilder.

protected Consul.Builder consulBuilder() {
    try {
        if (consulConfig == null) {
            System.out.println("Consul config file not specified; will not override Consul agent ACL token.");
        }
        final ConsulConfig config = consulConfig == null ? null : ConsulConfig.from(consulConfig);
        Consul.Builder builder = Consul.builder().withHostAndPort(HostAndPort.fromString(consulAgentAddress));
        if (config != null && !config.aclToken().isEmpty()) {
            System.out.println("Using Consul ACL token from " + consulConfig);
            builder.withAclToken(config.aclToken());
        }
        return builder;
    } catch (IOException e) {
        throw new ConfigException(e.getMessage());
    }
}
Also used : ConsulConfig(com.couchbase.connector.config.common.ConsulConfig) ConfigException(com.couchbase.connector.config.ConfigException) IOException(java.io.IOException) Consul(com.orbitz.consul.Consul)

Aggregations

ConfigException (com.couchbase.connector.config.ConfigException)1 ConsulConfig (com.couchbase.connector.config.common.ConsulConfig)1 Consul (com.orbitz.consul.Consul)1 IOException (java.io.IOException)1