Use PathBuf type to clarify usage of paths

This commit is contained in:
Dirkjan Ochtman 2021-12-13 16:47:14 +01:00 committed by masalachai
parent 79c69dfd1f
commit 375a151851
2 changed files with 5 additions and 4 deletions

View File

@ -26,14 +26,15 @@
//! ``` //! ```
use std::collections::HashMap; use std::collections::HashMap;
use std::path::PathBuf;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Paths to the client certificate and client key PEM files /// Paths to the client certificate and client key PEM files
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct EppClientTlsFiles { pub struct EppClientTlsFiles {
pub cert_chain: String, pub cert_chain: PathBuf,
pub key: String, pub key: PathBuf,
} }
/// Config that stores settings for multiple registries /// Config that stores settings for multiple registries

View File

@ -158,7 +158,7 @@ async fn epp_connect(
let mut r = BufReader::new(File::open(key_file).unwrap()); let mut r = BufReader::new(File::open(key_file).unwrap());
let mut rsa_keys = rustls_pemfile::rsa_private_keys(&mut r).unwrap(); let mut rsa_keys = rustls_pemfile::rsa_private_keys(&mut r).unwrap();
if rsa_keys.len() > 1 { if rsa_keys.len() > 1 {
warn!("Multiple RSA keys found in PEM file {}", key_file); warn!("Multiple RSA keys found in PEM file {:?}", key_file);
} }
key = rsa_keys.pop(); key = rsa_keys.pop();
@ -166,7 +166,7 @@ async fn epp_connect(
r.seek(SeekFrom::Start(0))?; r.seek(SeekFrom::Start(0))?;
let mut pkcs8_keys = rustls_pemfile::pkcs8_private_keys(&mut r).unwrap(); let mut pkcs8_keys = rustls_pemfile::pkcs8_private_keys(&mut r).unwrap();
if pkcs8_keys.len() > 1 { if pkcs8_keys.len() > 1 {
warn!("Multiple PKCS8 keys found in PEM file {}", key_file); warn!("Multiple PKCS8 keys found in PEM file {:?}", key_file);
} }
key = pkcs8_keys.pop(); key = pkcs8_keys.pop();
} }