diff options
author | Alex Auvolat <alex@adnab.me> | 2021-12-30 20:45:28 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-12-30 20:45:28 +0100 |
commit | c030c4764570974b09d2387854b30538e81e7b86 (patch) | |
tree | 5abb2249f067d6f70a2e3c6514947cc46f176f4c /src | |
parent | bcc185df400f0b459d78d6bdd3084ef5b6ac5e8a (diff) | |
download | tricot-c030c4764570974b09d2387854b30538e81e7b86.tar.gz tricot-c030c4764570974b09d2387854b30538e81e7b86.zip |
cargo fmt and improve error messagedocker-27
Diffstat (limited to 'src')
-rw-r--r-- | src/consul.rs | 9 | ||||
-rw-r--r-- | src/main.rs | 2 |
2 files changed, 7 insertions, 4 deletions
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 { diff --git a/src/main.rs b/src/main.rs index 857d24e..7023d67 100644 --- a/src/main.rs +++ b/src/main.rs @@ -101,7 +101,7 @@ async fn main() { info!("Starting Tricot"); - let consul_config = consul::ConsulConfig{ + let consul_config = consul::ConsulConfig { addr: opt.consul_addr.clone(), ca_cert: opt.consul_ca_cert.clone(), client_cert: opt.consul_client_cert.clone(), |