@@ -182,6 +182,8 @@ public final class PostgresqlConnectionFactoryProvider implements ConnectionFact
182
182
183
183
/**
184
184
* Ssl mode alias (JDBC style). Default: disabled
185
+ *
186
+ * @since 0.9.2
185
187
*/
186
188
public static final Option <SSLMode > SSL_MODE_ALIAS = Option .valueOf ("sslmode" );
187
189
@@ -298,25 +300,8 @@ private static void setupSsl(PostgresqlConnectionConfiguration.Builder builder,
298
300
}
299
301
});
300
302
301
- mapper .from (SSL_MODE ).map (it -> {
302
-
303
- if (it instanceof String ) {
304
- return SSLMode .fromValue (it .toString ());
305
- }
306
-
307
- return (SSLMode ) it ;
308
-
309
- }).to (builder ::sslMode ).otherwise (() -> {
310
-
311
- mapper .from (SSL_MODE_ALIAS ).map (it -> {
312
-
313
- if (it instanceof String ) {
314
- return SSLMode .fromValue (it .toString ());
315
- }
316
-
317
- return (SSLMode ) it ;
318
-
319
- }).to (builder ::sslMode );
303
+ mapper .from (SSL_MODE ).map (PostgresqlConnectionFactoryProvider ::toSSLMode ).to (builder ::sslMode ).otherwise (() -> {
304
+ mapper .from (SSL_MODE_ALIAS ).map (PostgresqlConnectionFactoryProvider ::toSSLMode ).to (builder ::sslMode );
320
305
});
321
306
322
307
mapper .fromTyped (SSL_CERT ).to (builder ::sslCert );
@@ -343,6 +328,14 @@ private static void setupSsl(PostgresqlConnectionConfiguration.Builder builder,
343
328
}).to (builder ::sslHostnameVerifier );
344
329
}
345
330
331
+ private static SSLMode toSSLMode (Object it ) {
332
+ if (it instanceof String ) {
333
+ return SSLMode .fromValue (it .toString ());
334
+ }
335
+
336
+ return (SSLMode ) it ;
337
+ }
338
+
346
339
@ SuppressWarnings ("unchecked" )
347
340
private static Map <String , String > convertToMap (Object options ) {
348
341
if (options instanceof Map ) {
0 commit comments