Skip to content

Commit

Permalink
Add support for namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
romans-ovo committed Jun 11, 2024
1 parent 04f099a commit b734bad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions teller-providers/src/providers/hashicorp_vault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub struct HashivaultOptions {
pub address: Option<String>,
/// Vault token
pub token: Option<String>,
/// Vault namespace
pub namespace: Option<String>,
}

pub struct Hashivault {
Expand All @@ -69,11 +71,16 @@ impl Hashivault {
settings.token(token);
}

if let Some(namespace) = opts.namespace {
settings.set_namespace(namespace);
}

settings.build().map_err(Box::from)?
} else {
VaultClientSettingsBuilder::default()
.address(env::var("VAULT_ADDR")?)
.token(env::var("VAULT_TOKEN")?)
.namespace(env::var("VAULT_NAMESPACE").ok())
.build()
.map_err(Box::from)?
};
Expand Down

0 comments on commit b734bad

Please sign in to comment.