cargo fmt and improve error message

This commit is contained in:
Alex 2021-12-30 20:45:28 +01:00
parent bcc185df40
commit c030c47645
No known key found for this signature in database
GPG key ID: EDABF9711E244EB1
2 changed files with 7 additions and 4 deletions

View file

@ -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 {

View file

@ -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(),