@@ -42,35 +42,12 @@ async fn main() -> Result<(), ()> {
4242 . init ( ) ;
4343
4444 // Ensure rustls has a single crypto provider selected at process start.
45- // When multiple crypto backends (ring, aws-lc-rs) are present the crate
46- // requires an explicit choice. Install the default provider now.
47- // Prefer the `ring` provider explicitly to avoid runtime ambiguity
48- // when multiple crypto backends are present in the dependency graph.
49- // Construct the provider from the `ring` module and install it.
50- let provider = rustls:: crypto:: ring:: default_provider ( ) ;
45+ // The aws-lc-rs backend is the default for rustls and is installed here
46+ // to avoid runtime ambiguity when multiple crypto backends are present.
47+ let provider = rustls:: crypto:: aws_lc_rs:: default_provider ( ) ;
5148 let _ = provider. install_default ( ) ;
5249
53- let mut config;
54- if args. config . exists ( ) {
55- config = Config :: read_from_file ( args. config ) . unwrap_or_else ( |( ) | std:: process:: exit ( 1 ) ) ;
56- } else {
57- tracing:: info!(
58- "No config file found at {}, creating a default config file." ,
59- args. config. display( )
60- ) ;
61- config = Config :: default ( ) ;
62-
63- let serialized_config =
64- toml:: to_string_pretty ( & config) . map_err ( |e| tracing:: error!( "Failed to serialize config: {e}" ) ) ?;
65-
66- let config_dir = args
67- . config
68- . parent ( )
69- . ok_or_else ( || tracing:: error!( "Failed to get parent directory of config file." ) ) ?;
70- std:: fs:: create_dir_all ( config_dir) . map_err ( |e| tracing:: error!( "Failed to create config directory: {e}" ) ) ?;
71- std:: fs:: write ( args. config , serialized_config)
72- . map_err ( |e| tracing:: error!( "Failed to save config file: {e}" ) ) ?;
73- }
50+ let mut config = Config :: load_or_create ( & args. config ) . await ?;
7451
7552 // Resolve these paths so that the rest of the code doesn't need to.
7653 let cert_path = config. webserver . certificate . to_string_lossy ( ) . to_string ( ) ;
0 commit comments