@@ -171,6 +171,8 @@ public final class PostgresqlConnectionFactoryProvider implements ConnectionFact
171
171
172
172
/**
173
173
* Ssl mode alias (JDBC style). Default: disabled
174
+ *
175
+ * @since 0.8.13
174
176
*/
175
177
public static final Option <SSLMode > SSL_MODE_ALIAS = Option .valueOf ("sslmode" );
176
178
@@ -285,25 +287,8 @@ private static void setupSsl(PostgresqlConnectionConfiguration.Builder builder,
285
287
}
286
288
});
287
289
288
- mapper .from (SSL_MODE ).map (it -> {
289
-
290
- if (it instanceof String ) {
291
- return SSLMode .fromValue (it .toString ());
292
- }
293
-
294
- return (SSLMode ) it ;
295
-
296
- }).to (builder ::sslMode ).otherwise (() -> {
297
-
298
- mapper .from (SSL_MODE_ALIAS ).map (it -> {
299
-
300
- if (it instanceof String ) {
301
- return SSLMode .fromValue (it .toString ());
302
- }
303
-
304
- return (SSLMode ) it ;
305
-
306
- }).to (builder ::sslMode );
290
+ mapper .from (SSL_MODE ).map (PostgresqlConnectionFactoryProvider ::toSSLMode ).to (builder ::sslMode ).otherwise (() -> {
291
+ mapper .from (SSL_MODE_ALIAS ).map (PostgresqlConnectionFactoryProvider ::toSSLMode ).to (builder ::sslMode );
307
292
});
308
293
309
294
mapper .from (SSL_CERT ).to (builder ::sslCert );
@@ -330,6 +315,14 @@ private static void setupSsl(PostgresqlConnectionConfiguration.Builder builder,
330
315
}).to (builder ::sslHostnameVerifier );
331
316
}
332
317
318
+ private static SSLMode toSSLMode (Object it ) {
319
+ if (it instanceof String ) {
320
+ return SSLMode .fromValue (it .toString ());
321
+ }
322
+
323
+ return (SSLMode ) it ;
324
+ }
325
+
333
326
@ SuppressWarnings ("unchecked" )
334
327
private static Map <String , String > convertToMap (Object options ) {
335
328
if (options instanceof Map ) {
0 commit comments