From c030c4764570974b09d2387854b30538e81e7b86 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 30 Dec 2021 20:45:28 +0100 Subject: cargo fmt and improve error message --- src/consul.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/consul.rs') diff --git a/src/consul.rs b/src/consul.rs index 8eafcc2..14df1ee 100644 --- a/src/consul.rs +++ b/src/consul.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use std::fs::File; use std::io::Read; -use anyhow::Result; +use anyhow::{bail, Result}; use bytes::Bytes; use log::*; use reqwest::StatusCode; @@ -100,10 +100,13 @@ impl Consul { reqwest::Client::builder() .use_rustls_tls() .add_root_certificate(reqwest::Certificate::from_pem(&ca_cert_buf[..])?) - .identity(reqwest::Identity::from_pem(&[&client_cert_buf[..], &client_key_buf[..]].concat()[..])?) + .identity(reqwest::Identity::from_pem( + &[&client_cert_buf[..], &client_key_buf[..]].concat()[..], + )?) .build()? } - _ => reqwest::Client::new(), + (None, None, None) => reqwest::Client::new(), + _ => bail!("Incomplete Consul TLS configuration parameters"), }; Ok(Self { -- cgit v1.2.3