Fix example config and an unwrap in main()

Was panicking on missing cert file. Oops. Now prints an error like it
should
This commit is contained in:
2026-06-01 11:30:24 -07:00
parent 2770d8d6a5
commit 0f9f89cdd4
2 changed files with 18 additions and 5 deletions
+1 -1
View File
@@ -19,5 +19,5 @@ admins = []
url = "my.db.server" url = "my.db.server"
user = "confetti" user = "confetti"
password = "my_secret_password" password = "my_secret_password"
db = "confetti" db_name = "confetti"
num_connections = 8 num_connections = 8
+17 -4
View File
@@ -112,10 +112,23 @@ async fn main() -> ExitCode {
// Read certificate file // Read certificate file
let certs = CertificateDer::pem_file_iter(&config.certfile) debug!("Reading certificate file");
.unwrap() let certs = match CertificateDer::pem_file_iter(&config.certfile) {
.map(|cert| cert.unwrap()) Ok(certs) => match certs.collect::<Result<Vec<_>,_>>() {
.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 key = PrivateKeyDer::from_pem_file(&config.keyfile).unwrap();
let address = match IpAddr::from_str(&config.listen_address) { let address = match IpAddr::from_str(&config.listen_address) {