src/main/java/org/embulk/input/RedshiftInputPlugin.java in embulk-input-redshift-0.7.2 vs src/main/java/org/embulk/input/RedshiftInputPlugin.java in embulk-input-redshift-0.7.3

- old
+ new

@@ -37,10 +37,14 @@ public String getDatabase(); @Config("schema") @ConfigDefault("\"public\"") public String getSchema(); + + @Config("ssl") + @ConfigDefault("false") + public boolean getSsl(); } @Override protected Class<? extends PluginTask> getTaskClass() { @@ -63,19 +67,16 @@ // Enable keepalive based on tcp_keepalive_time, tcp_keepalive_intvl and tcp_keepalive_probes kernel parameters. // Socket options TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL are not configurable. props.setProperty("tcpKeepAlive", "true"); - // TODO - //switch t.getSssl() { - //when "disable": - // break; - //when "enable": - // props.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory"); // disable server-side validation - //when "verify": - // props.setProperty("ssl", "true"); - // break; - //} + if (t.getSsl()) { + // TODO add ssl_verify (boolean) option to allow users to verify certification. + // see embulk-input-ftp for SSL implementation. + props.setProperty("ssl", "true"); + props.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory"); // disable server-side validation + } + // setting ssl=false enables SSL. See org.postgresql.core.v3.openConnectionImpl. props.putAll(t.getOptions()); Connection con = driver.connect(url, props); try {