Crates.io | vaultier |
lib.rs | vaultier |
version | |
source | src |
created_at | 2023-09-06 11:20:17.993569+00 |
updated_at | 2025-01-06 13:10:06.587858+00 |
description | Crate to write and read secrets from Hashicorp Vault. |
homepage | |
repository | https://github.com/commercetools/vaultier |
max_upload_size | |
id | 965191 |
Cargo.toml error: | TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
/slɒθ/
:sloth:Small crate to read secrets from Hashicorp Vault. Based on vaultrs.
use vaultier::SecretClient;
use serde::Deserialize;
#[derive(Deserialize)]
struct MySecrets {
pub username: String,
pub password: String,
}
let address = "<vault instance address>";
let mount = String::from("<mount>");
let base_path = String::from("<base_path>");
// With token or default feature enabled
let client = SecretClient::new(address, mount, base_path, None).unwrap();
// With auth feature enabled
let auth_mount = "<mount to vault auth>";
let role = "<your role>";
let client = SecretClient::create(address, auth_mount, role, mount, base_path).unwrap();
// read secrets from that base path
let secrets = client.read_secrets::<MySecrets>().await.unwrap();
// read secrets from the passed path relative to the base path: mount/data/base_path/my-secrets
let secrets = client.read_secrets_from::<MySecrets>("my-secrets").await.unwrap();