From 0f9f89cdd4280832fb4737082fb8db3e3ac6d232 Mon Sep 17 00:00:00 2001 From: Waylon Cude Date: Mon, 1 Jun 2026 11:30:24 -0700 Subject: [PATCH] Fix example config and an unwrap in main() Was panicking on missing cert file. Oops. Now prints an error like it should --- confetti.toml.example | 2 +- src/main.rs | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/confetti.toml.example b/confetti.toml.example index 063102d..d46de46 100644 --- a/confetti.toml.example +++ b/confetti.toml.example @@ -19,5 +19,5 @@ admins = [] url = "my.db.server" user = "confetti" password = "my_secret_password" -db = "confetti" +db_name = "confetti" num_connections = 8 diff --git a/src/main.rs b/src/main.rs index be53d43..fe348f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -112,10 +112,23 @@ async fn main() -> ExitCode { // Read certificate file - let certs = CertificateDer::pem_file_iter(&config.certfile) - .unwrap() - .map(|cert| cert.unwrap()) - .collect(); + debug!("Reading certificate file"); + let certs = match CertificateDer::pem_file_iter(&config.certfile) { + Ok(certs) => match certs.collect::,_>>() { + Ok(k) => k, + Err(e) => { + error!("Could not read certificates."); + error!("{}",e); + return ExitCode::FAILURE + } + + }, + Err(e) => { + error!("Could not read certificates."); + error!("{}",e); + return ExitCode::FAILURE + } + }; let key = PrivateKeyDer::from_pem_file(&config.keyfile).unwrap(); let address = match IpAddr::from_str(&config.listen_address) {