Skip to content

Commit 378dc1e

Browse files
author
Selcuk Holep
committed
Added protocol config to bypass certificates.
1 parent df05ef5 commit 378dc1e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/main/java/com/ibm/eventstreams/connect/elasticsink/ElasticSinkConnector.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ public class ElasticSinkConnector extends SinkConnector {
4242
public static final String CONFIG_DOCUMENTATION_ES_CONNECTION = "The hostname:port to connect to Elasticsearch.";
4343
public static final String CONFIG_DISPLAY_ES_CONNECTION = "hostname:port";
4444

45+
public static final String DEFAULT_ES_PROTOCOL = "http";
46+
public static final String CONFIG_NAME_ES_PROTOCOL = "es.protocol";
47+
public static final String CONFIG_DOCUMENTATION_ES_PROTOCOL = "The protocol to connect to Elasticsearch.";
48+
public static final String CONFIG_DISPLAY_ES_PROTOCOL = "HTTP/ HTTPS";
49+
4550
public static final String CONFIG_NAME_ES_USER_NAME = "es.user.name";
4651
public static final String CONFIG_DOCUMENTATION_ES_USER_NAME = "The user name for authenticating with Elasticsearch.";
4752
public static final String CONFIG_DISPLAY_ES_USER_NAME = "User name";
@@ -210,6 +215,10 @@ public ConfigDef config() {
210215
CONFIG_DOCUMENTATION_ES_PASSWORD, CONFIG_GROUP_ES, 3, Width.MEDIUM,
211216
CONFIG_DISPLAY_ES_PASSWORD);
212217

218+
config.define(CONFIG_NAME_ES_PROTOCOL, Type.STRING, DEFAULT_ES_PROTOCOL, Importance.MEDIUM,
219+
CONFIG_DOCUMENTATION_ES_PROTOCOL, CONFIG_GROUP_ES, 4, Width.MEDIUM,
220+
CONFIG_DISPLAY_ES_PROTOCOL);
221+
213222
config.define(CONFIG_NAME_ES_TLS_KEYSTORE_LOCATION, Type.STRING, null, Importance.MEDIUM,
214223
CONFIG_DOCUMENTATION_ES_TLS_KEYSTORE_LOCATION, CONFIG_GROUP_ES, 10, Width.MEDIUM,
215224
CONFIG_DISPLAY_ES_TLS_KEYSTORE_LOCATION);

src/main/java/com/ibm/eventstreams/connect/elasticsink/ElasticWriter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public class ElasticWriter {
6969
private String trustStore;
7070
private String trustStorePassword;
7171

72-
private String protocol = "http";
72+
private String protocol;
7373
private String proxyHost = null;
7474
private int proxyPort = 0;
7575

@@ -107,6 +107,7 @@ public void configure(Map<String, String> props) throws ConnectException {
107107
keyStorePassword = props.get(ElasticSinkConnector.CONFIG_NAME_ES_TLS_KEYSTORE_PASSWORD);
108108
trustStore = props.get(ElasticSinkConnector.CONFIG_NAME_ES_TLS_TRUSTSTORE_LOCATION);
109109
trustStorePassword = props.get(ElasticSinkConnector.CONFIG_NAME_ES_TLS_TRUSTSTORE_PASSWORD);
110+
protocol = props.getOrDefault(ElasticSinkConnector.CONFIG_NAME_ES_PROTOCOL,ElasticSinkConnector.DEFAULT_ES_PROTOCOL);
110111

111112
// Jetty configuration for HTTP client behaviour
112113
proxyHost = props.get(ElasticSinkConnector.CONFIG_NAME_ES_HTTP_PROXY_HOST);

0 commit comments

Comments
 (0)