Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Haennetz committed Feb 23, 2024
1 parent e886cbc commit c7ac4f7
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,6 @@ impl VaultClientSettingsBuilder {
}

fn default_identity(&self) -> Option<reqwest::Identity> {
let mut identity: Option<reqwest::Identity> = None;

// Default value can be set from environment
let env_client_cert = env::var("VAULT_CLIENT_CERT").unwrap_or_default();
let env_client_key = env::var("VAULT_CLIENT_KEY").unwrap_or_default();
Expand All @@ -268,7 +266,7 @@ impl VaultClientSettingsBuilder {
return None;
}

#[cfg(feature="rustls")]
#[cfg(feature = "rustls")]
{
let mut client_cert = match fs::read(&env_client_cert) {
Ok(content) => content,
Expand All @@ -289,17 +287,18 @@ impl VaultClientSettingsBuilder {
// concat certificate and key
client_cert.append(&mut client_key);

let pkcs8 = reqwest::Identity::from_pem(&client_cert).unwrap();

identity = Some(pkcs8);
match reqwest::Identity::from_pem(&client_cert) {
Ok(pkcs8) => return Some(pkcs8),
Err(err) => error!("error creating identity: {}", err),
};
}

#[cfg(feature="native-tls")]
#[cfg(feature = "native-tls")]
{
panic!("Client certificates not implemented for native-tls");
error!("Client certificates not implemented for native-tls");
}

identity
None
}

fn validate(&self) -> Result<(), String> {
Expand Down

0 comments on commit c7ac4f7

Please sign in to comment.