Expand description
Turning the secret store on.
โ
#[tokio::main]
async fn main() -> Result<()> {
let vault = Vault::from_env()?.resolving("database").resolving("mail");
let app = App::new()?;
// Before anything reads configuration: swap every `vault:` reference
// for the secret it names, or refuse to start.
vault.resolve(app.config()).await?;
app.plugin(vault).serve().await
}Resolution is a step the application takes, not something the plugin does
behind its back, and that is deliberate. Plugin::register is synchronous โ
reading a secret is not โ and more importantly a boot that carried on
because a secret could not be fetched is the exact failure this package
exists to prevent. Written this way, the ? is visible in main.
What registering does do is put the client and the Renewer where the
rest of the application can reach them, and say so loudly when the store is
being talked to in a way that leaks the token.
Structsยง
- Vault
- The secret store, as an application enables it.