From 9b6c1dc272f47f838f25f49add6011be9d322d30 Mon Sep 17 00:00:00 2001 From: Nick Gerakines Date: Mon, 13 Feb 2023 18:08:10 -0500 Subject: [PATCH 1/3] Updating dependency versions --- Cargo.toml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0d849ff..9bb2bc6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,26 +15,26 @@ members = [ ] [dependencies] -async-trait = "0.1.51" -base64 = "0.13.0" +async-trait = "0.1.64" +base64 = "0.21.0" consulrs_derive = { version = "0.1.0", path = "consulrs_derive" } -derive_builder = "0.10.2" -http = "0.2.5" -reqwest = { version = "0.11.4", default-features = false, features = ["rustls-tls"] } -rustify = "0.5.2" +derive_builder = "0.12.0" +http = "0.2.8" +reqwest = { version = "0.11.14", default-features = false, features = ["rustls-tls"] } +rustify = "0.5.3" rustify_derive = "0.5.2" -serde = "1.0.130" -serde_json = "1.0.66" -serde_with = "1.10.0" -thiserror = "1.0.29" -tracing = "0.1.28" -url = "2.2.2" +serde = "1.0.152" +serde_json = "1.0.93" +serde_with = "2.2.0" +thiserror = "1.0.38" +tracing = "0.1.37" +url = "2.3.1" [dev-dependencies] dockertest-server = { version = "0.1.4", features=["hashi"] } -env_logger = "0.9.0" -futures = "0.3.17" -test-log = { version = "0.2.8", features = ["trace"] } -tokio = { version = "1.12.0", features = ["full"] } +env_logger = "0.10.0" +futures = "0.3.26" +test-log = { version = "0.2.11", features = ["trace"] } +tokio = { version = "1.25.0", features = ["full"] } tokio-test = "0.4.2" -tracing-subscriber = {version = "0.2.17", default-features = false, features = ["env-filter", "fmt"]} +tracing-subscriber = {version = "0.3.16", default-features = false, features = ["env-filter", "fmt"]} From 1ce427baa7f58da9206a43c4068357014c8035a4 Mon Sep 17 00:00:00 2001 From: Nick Gerakines Date: Mon, 13 Feb 2023 19:22:14 -0500 Subject: [PATCH 2/3] wip --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9bb2bc6..a59bcb7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,11 +17,11 @@ members = [ [dependencies] async-trait = "0.1.64" base64 = "0.21.0" -consulrs_derive = { version = "0.1.0", path = "consulrs_derive" } +consulrs_derive = { path = "consulrs_derive" } derive_builder = "0.12.0" http = "0.2.8" reqwest = { version = "0.11.14", default-features = false, features = ["rustls-tls"] } -rustify = "0.5.3" +rustify = {version = "0.5.3", default-features = false, features = ["rustls-tls"]} rustify_derive = "0.5.2" serde = "1.0.152" serde_json = "1.0.93" From b7c5d6dc9e8edb893fe59a2d54ac328d141d3f0b Mon Sep 17 00:00:00 2001 From: Nick Gerakines Date: Mon, 13 Feb 2023 20:41:26 -0500 Subject: [PATCH 3/3] Check, clippy, and fmt --- Cargo.toml | 2 +- src/api/kv/common.rs | 5 ++++- src/client.rs | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a59bcb7..5d07206 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT" readme = "README.md" repository = "https://github.com/jmgilman/consulrs" keywords = ["Consul", "API", "Client", "Hashicorp"] -edition = "2018" +edition = "2021" [workspace] members = [ diff --git a/src/api/kv/common.rs b/src/api/kv/common.rs index 2e6252c..be0e297 100644 --- a/src/api/kv/common.rs +++ b/src/api/kv/common.rs @@ -1,5 +1,6 @@ use std::convert::TryInto; +use base64::{engine::general_purpose, Engine as _}; use derive_builder::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_with::skip_serializing_none; @@ -14,7 +15,9 @@ impl TryInto> for Base64String { type Error = ClientError; fn try_into(self) -> Result, Self::Error> { - base64::decode(&self.0).map_err(|e| ClientError::Base64DecodeError { source: e }) + general_purpose::STANDARD + .decode(self.0.as_bytes()) + .map_err(|e| ClientError::Base64DecodeError { source: e }) } } diff --git a/src/client.rs b/src/client.rs index 1dc6053..a23baef 100644 --- a/src/client.rs +++ b/src/client.rs @@ -65,7 +65,7 @@ impl ConsulClient { // Adds CA certificates for path in &settings.ca_certs { - let content = std::fs::read(&path).map_err(|e| ClientError::FileReadError { + let content = std::fs::read(path).map_err(|e| ClientError::FileReadError { source: e, path: path.clone(), })?; @@ -83,12 +83,12 @@ impl ConsulClient { // Add client certificate if let (Some(cert), Some(key)) = (&settings.client_cert, &settings.client_key) { let cert_content = - std::fs::read_to_string(&cert).map_err(|e| ClientError::FileReadError { + std::fs::read_to_string(cert).map_err(|e| ClientError::FileReadError { source: e, path: cert.clone(), })?; let key_content = - std::fs::read_to_string(&key).map_err(|e| ClientError::FileReadError { + std::fs::read_to_string(key).map_err(|e| ClientError::FileReadError { source: e, path: key.clone(), })?;