@@ -21,32 +21,27 @@ pub enum Error {
2121 } ,
2222}
2323
24- #[ instrument( skip( opt_tsl_config) ) ]
25- pub async fn make_rust_tls ( opt_tsl_config : & Option < TslConfig > ) -> Option < Result < RustlsConfig , Error > > {
26- match opt_tsl_config {
27- Some ( tsl_config) => {
28- let cert = tsl_config. ssl_cert_path . clone ( ) ;
29- let key = tsl_config. ssl_key_path . clone ( ) ;
24+ #[ instrument( skip( tsl_config) ) ]
25+ pub async fn make_rust_tls ( tsl_config : & TslConfig ) -> Option < Result < RustlsConfig , Error > > {
26+ let cert = tsl_config. ssl_cert_path . clone ( ) ;
27+ let key = tsl_config. ssl_key_path . clone ( ) ;
3028
31- if !cert. exists ( ) || !key. exists ( ) {
32- return Some ( Err ( Error :: MissingTlsConfig {
33- location : Location :: caller ( ) ,
34- } ) ) ;
35- }
29+ if !cert. exists ( ) || !key. exists ( ) {
30+ return Some ( Err ( Error :: MissingTlsConfig {
31+ location : Location :: caller ( ) ,
32+ } ) ) ;
33+ }
3634
37- tracing:: info!( "Using https: cert path: {cert}." ) ;
38- tracing:: info!( "Using https: key path: {key}." ) ;
35+ tracing:: info!( "Using https: cert path: {cert}." ) ;
36+ tracing:: info!( "Using https: key path: {key}." ) ;
3937
40- Some (
41- RustlsConfig :: from_pem_file ( cert, key)
42- . await
43- . map_err ( |err| Error :: BadTlsConfig {
44- source : ( Arc :: new ( err) as DynError ) . into ( ) ,
45- } ) ,
46- )
47- }
48- None => None ,
49- }
38+ Some (
39+ RustlsConfig :: from_pem_file ( cert, key)
40+ . await
41+ . map_err ( |err| Error :: BadTlsConfig {
42+ source : ( Arc :: new ( err) as DynError ) . into ( ) ,
43+ } ) ,
44+ )
5045}
5146
5247#[ cfg( test) ]
0 commit comments