@@ -61,6 +61,8 @@ pub struct MySqlConnectOptions {
61
61
pub ( crate ) database : Option < String > ,
62
62
pub ( crate ) ssl_mode : MySqlSslMode ,
63
63
pub ( crate ) ssl_ca : Option < CertificateInput > ,
64
+ pub ( crate ) ssl_client_cert : Option < CertificateInput > ,
65
+ pub ( crate ) ssl_client_key : Option < CertificateInput > ,
64
66
pub ( crate ) statement_cache_capacity : usize ,
65
67
pub ( crate ) charset : String ,
66
68
pub ( crate ) collation : Option < String > ,
@@ -87,6 +89,8 @@ impl MySqlConnectOptions {
87
89
collation : None ,
88
90
ssl_mode : MySqlSslMode :: Preferred ,
89
91
ssl_ca : None ,
92
+ ssl_client_cert : None ,
93
+ ssl_client_key : None ,
90
94
statement_cache_capacity : 100 ,
91
95
log_settings : Default :: default ( ) ,
92
96
}
@@ -184,6 +188,36 @@ impl MySqlConnectOptions {
184
188
self
185
189
}
186
190
191
+ /// Sets the name of a file containing SSL client certificate.
192
+ ///
193
+ /// # Example
194
+ ///
195
+ /// ```rust
196
+ /// # use sqlx_core::mysql::{MySqlSslMode, MySqlConnectOptions};
197
+ /// let options = MySqlConnectOptions::new()
198
+ /// .ssl_mode(MySqlSslMode::VerifyCa)
199
+ /// .ssl_client_cert("path/to/client.crt");
200
+ /// ```
201
+ pub fn ssl_client_cert ( mut self , cert : impl AsRef < Path > ) -> Self {
202
+ self . ssl_client_cert = Some ( CertificateInput :: File ( cert. as_ref ( ) . to_path_buf ( ) ) ) ;
203
+ self
204
+ }
205
+
206
+ /// Sets the name of a file containing SSL client key.
207
+ ///
208
+ /// # Example
209
+ ///
210
+ /// ```rust
211
+ /// # use sqlx_core::mysql::{MySqlSslMode, MySqlConnectOptions};
212
+ /// let options = MySqlConnectOptions::new()
213
+ /// .ssl_mode(MySqlSslMode::VerifyCa)
214
+ /// .ssl_client_key("path/to/client.key");
215
+ /// ```
216
+ pub fn ssl_client_key ( mut self , key : impl AsRef < Path > ) -> Self {
217
+ self . ssl_client_key = Some ( CertificateInput :: File ( key. as_ref ( ) . to_path_buf ( ) ) ) ;
218
+ self
219
+ }
220
+
187
221
/// Sets the capacity of the connection's statement cache in a number of stored
188
222
/// distinct statements. Caching is handled using LRU, meaning when the
189
223
/// amount of queries hits the defined limit, the oldest statement will get
0 commit comments