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:
@@ -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
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user