Open
Description
We need to document with an example how it's possible to add a custom configuration for the Vert.x SQL client.
For example:
public class PgClientPoolConfiguration extends DefaultSqlClientPoolConfiguration {
private static String HIBERNATE_VERTX_PGSQL_SSL = "hibernate.vertx.pgsql.ssl";
private static String HIBERNATE_VERTX_PGSQL_SSL_MODE = "hibernate.vertx.pgsql.ssl.mode";
private boolean ssl;
private String sslMode;
@Override
public void configure(Map configuration) {
super.configure(configuration);
ssl = ConfigurationHelper.getBoolean(HIBERNATE_VERTX_PGSQL_SSL, configuration);
sslMode = ConfigurationHelper.getString(HIBERNATE_VERTX_PGSQL_SSL_MODE, configuration);
}
@Override
public SqlConnectOptions connectOptions(URI uri) {
SqlConnectOptions sqlConnectOptions = super.connectOptions(uri);
PgConnectOptions pgConnectOptions = new PgConnectOptions(sqlConnectOptions);
if (ssl) {
pgConnectOptions.setSsl(true);
pgConnectOptions.setTrustAll(true);
pgConnectOptions.setSslMode(SslMode.of(sslMode));
}
return pgConnectOptions;
}
}
Related to this: #1108 (comment)