aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-server/src/settings.rs
diff options
context:
space:
mode:
authorConrad Ludgate <conradludgate@gmail.com>2024-01-28 13:33:45 +0000
committerGitHub <noreply@github.com>2024-01-28 13:33:45 +0000
commitbdcb143996567c9540fb411bc53448355665747b (patch)
treec8152a7cfdf0f2d45c5f7e15a17b577206698340 /atuin-server/src/settings.rs
parentchore: use resolver 2, update editions + cargo (#1635) (diff)
downloadatuin-bdcb143996567c9540fb411bc53448355665747b.zip
chore(deps): update axum (#1637)
Diffstat (limited to 'atuin-server/src/settings.rs')
-rw-r--r--atuin-server/src/settings.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/atuin-server/src/settings.rs b/atuin-server/src/settings.rs
index 1b152013..2d00df36 100644
--- a/atuin-server/src/settings.rs
+++ b/atuin-server/src/settings.rs
@@ -116,10 +116,9 @@ impl Tls {
.with_context(|| format!("tls.cert_path {:?} is missing", self.cert_path))?;
let mut reader = std::io::BufReader::new(cert_file);
let certs: Vec<_> = rustls_pemfile::certs(&mut reader)
- .with_context(|| format!("tls.cert_path {:?} is invalid", self.cert_path))?
- .into_iter()
- .map(rustls::Certificate)
- .collect();
+ .map(|c| c.map(|c| rustls::Certificate(c.to_vec())))
+ .collect::<Result<Vec<_>, _>>()
+ .with_context(|| format!("tls.cert_path {:?} is invalid", self.cert_path))?;
if certs.is_empty() {
bail!(
@@ -136,6 +135,8 @@ impl Tls {
.with_context(|| format!("tls.pkey_path {:?} is missing", self.pkey_path))?;
let mut reader = std::io::BufReader::new(pkey_file);
let keys = rustls_pemfile::pkcs8_private_keys(&mut reader)
+ .map(|c| c.map(|c| rustls::PrivateKey(c.secret_pkcs8_der().to_vec())))
+ .collect::<Result<Vec<_>, _>>()
.with_context(|| format!("tls.pkey_path {:?} is not PKCS8-encoded", self.pkey_path))?;
if keys.is_empty() {
@@ -145,8 +146,6 @@ impl Tls {
);
}
- let key = rustls::PrivateKey(keys[0].clone());
-
- Ok(key)
+ Ok(keys[0].clone())
}
}