@@ -28,6 +28,8 @@ public actor SparkConnectClient {
2828 let host : String
2929 let port : Int
3030 let token : String ?
31+ var useTLS : Bool = false
32+ let transportSecurity : HTTP2ClientTransport . Posix . TransportSecurity
3133 var intercepters : [ ClientInterceptor ] = [ ]
3234 let userContext : UserContext
3335 var sessionID : String ? = nil
@@ -56,6 +58,10 @@ public actor SparkConnectClient {
5658 token = String ( kv [ 1 ] )
5759 case URIParams . PARAM_USER_ID:
5860 userName = String ( kv [ 1 ] )
61+ case URIParams . PARAM_USE_SSL:
62+ if String ( kv [ 1 ] ) . lowercased ( ) == " true " {
63+ self . useTLS = true
64+ }
5965 default :
6066 // Print warning and ignore
6167 print ( " Unknown parameter: \( param) " )
@@ -65,6 +71,11 @@ public actor SparkConnectClient {
6571 if let token = self . token {
6672 self . intercepters. append ( BearerTokenInterceptor ( token: token) )
6773 }
74+ if self . useTLS {
75+ self . transportSecurity = . tls
76+ } else {
77+ self . transportSecurity = . plaintext
78+ }
6879 self . userContext = userName. toUserContext
6980 }
7081
@@ -99,7 +110,7 @@ public actor SparkConnectClient {
99110 try await withGRPCClient (
100111 transport: . http2NIOPosix(
101112 target: . dns( host: self . host, port: self . port) ,
102- transportSecurity: . plaintext
113+ transportSecurity: self . transportSecurity
103114 ) ,
104115 interceptors: self . intercepters
105116 ) { client in
0 commit comments