pub struct Vault { /* private fields */ }Expand description
The secret store, as an application enables it.
| Config key | Meaning |
|---|---|
vault.resolve | Configuration roots to search for references, as an array. |
Implementations§
Source§impl Vault
impl Vault
pub fn new(client: VaultClient) -> Vault
Sourcepub fn from_env() -> Result<Vault>
pub fn from_env() -> Result<Vault>
Take the address, token and namespace from the environment, the way every other Vault and OpenBao tool does.
Sourcepub fn resolving(self, root: impl Into<String>) -> Vault
pub fn resolving(self, root: impl Into<String>) -> Vault
Also search this configuration subtree for vault: references.
Named rather than discovered because Config cannot be enumerated,
and because a resolver that walked everything would read secrets for
keys nobody asked it to touch.
Sourcepub fn even_over_http(self) -> Vault
pub fn even_over_http(self) -> Vault
Do not warn about a plain-HTTP address.
Spelled out in full because of what it means: the token goes over the wire in clear text, and a token is the whole store. Loopback addresses never warn in the first place, so this is only for a network you have decided to trust.
pub fn client(&self) -> &VaultClient
Sourcepub fn renewer(&self) -> &Arc<Renewer> ⓘ
pub fn renewer(&self) -> &Arc<Renewer> ⓘ
The renewer this plugin registers.
Whatever issues a lease — a login, a dynamic database credential — hands it here, and it is kept alive until the application stops.
Sourcepub async fn resolve(&self, config: &Config) -> Result<usize>
pub async fn resolve(&self, config: &Config) -> Result<usize>
Swap every vault: reference in configuration for the secret it names,
and say how many were replaced.
The roots come from Vault::resolving, or from vault.resolve in
configuration when the builder named none — a value written in
main.rs is a decision and a value in a config file is a default.
Sourcepub async fn resolve_env(&self) -> Result<usize>
pub async fn resolve_env(&self) -> Result<usize>
Swap every vault: reference in the process environment.
For an application whose secrets arrive as DATABASE_URL=vault:…. Call
it before the application boots, so .env and the configuration
defaults see values rather than references.