55import java .util .Map ;
66
77/** Client-side TLS settings resolved from environment variables or tests. */
8- public record TlsClientConfig (
9- boolean enabled , Path trustStoreFile , String trustStorePassword , boolean trustAllCertificates ) {
8+ public record TlsClientConfig (boolean enabled , Path trustStoreFile , String trustStorePassword ) {
109 public static final String ENV_TLS_ENABLED = "NETWORK_CHAT_TLS" ;
1110 public static final String ENV_TRUSTSTORE = "NETWORK_CHAT_TRUSTSTORE" ;
1211 public static final String ENV_TRUSTSTORE_PASSWORD = "NETWORK_CHAT_TRUSTSTORE_PASSWORD" ;
1312 public static final String ENV_TRUST_ALL = "NETWORK_CHAT_TLS_TRUST_ALL" ;
1413
1514 public static TlsClientConfig disabled () {
16- return new TlsClientConfig (false , null , "" , false );
15+ return new TlsClientConfig (false , null , "" );
1716 }
1817
1918 public static TlsClientConfig fromEnvironment () {
@@ -22,11 +21,14 @@ public static TlsClientConfig fromEnvironment() {
2221
2322 public static TlsClientConfig fromEnvironment (Map <String , String > environment ) {
2423 boolean enabled = booleanEnvironment (environment , ENV_TLS_ENABLED );
25- boolean trustAll = booleanEnvironment (environment , ENV_TRUST_ALL );
24+ if (booleanEnvironment (environment , ENV_TRUST_ALL )) {
25+ throw new IllegalArgumentException (
26+ ENV_TRUST_ALL + " is not supported; configure " + ENV_TRUSTSTORE + " instead." );
27+ }
2628 String trustStore = environment .get (ENV_TRUSTSTORE );
2729 Path trustStoreFile = trustStore == null || trustStore .isBlank () ? null : Path .of (trustStore );
2830 return new TlsClientConfig (
29- enabled , trustStoreFile , environment .getOrDefault (ENV_TRUSTSTORE_PASSWORD , "" ), trustAll );
31+ enabled , trustStoreFile , environment .getOrDefault (ENV_TRUSTSTORE_PASSWORD , "" ));
3032 }
3133
3234 private static boolean booleanEnvironment (Map <String , String > environment , String name ) {
0 commit comments