Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor updates and cleanup #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@ license = "MIT"
readme = "README.md"
repository = "https://github.com/jmgilman/consulrs"
keywords = ["Consul", "API", "Client", "Hashicorp"]
edition = "2018"
edition = "2021"

[workspace]
members = [
"consulrs_derive",
]

[dependencies]
async-trait = "0.1.51"
base64 = "0.13.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"
async-trait = "0.1.64"
base64 = "0.21.0"
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 = {version = "0.5.3", default-features = false, features = ["rustls-tls"]}
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"]}
5 changes: 4 additions & 1 deletion src/api/kv/common.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -14,7 +15,9 @@ impl TryInto<Vec<u8>> for Base64String {
type Error = ClientError;

fn try_into(self) -> Result<Vec<u8>, 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 })
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
})?;
Expand All @@ -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(),
})?;
Expand Down