From b734bad6633059475b92dd139ac9884ead56e70f Mon Sep 17 00:00:00 2001 From: Romans Malinovskis Date: Tue, 11 Jun 2024 17:47:31 +0200 Subject: [PATCH] Add support for namespaces --- teller-providers/src/providers/hashicorp_vault.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/teller-providers/src/providers/hashicorp_vault.rs b/teller-providers/src/providers/hashicorp_vault.rs index 6de3a68e..f12dc9f2 100644 --- a/teller-providers/src/providers/hashicorp_vault.rs +++ b/teller-providers/src/providers/hashicorp_vault.rs @@ -44,6 +44,8 @@ pub struct HashivaultOptions { pub address: Option, /// Vault token pub token: Option, + /// Vault namespace + pub namespace: Option, } pub struct Hashivault { @@ -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)? };