| Crates.io | coult |
| lib.rs | coult |
| version | 0.3.0 |
| created_at | 2021-10-18 01:03:06.143941+00 |
| updated_at | 2025-06-05 03:59:11.114055+00 |
| description | Hashicorp vault secret retrival helper, using hyper and serde, and automatically parsing. |
| homepage | https://github.com/guaychou/coult |
| repository | https://github.com/guaychou/coult |
| max_upload_size | |
| id | 466483 |
| size | 49,331 |
A simple, async Vault client in Rust using Hyper v1, hyper-rustls, and Tokio for secure communication with HashiCorp Vault.
Supports Vault HTTP API v1 (health check, secrets retrieval)
Compatible with Vault secret engines v1 and v2
TLS support with hyper-rustls and WebPKI roots
Async and efficient using hyper-util and tokio
Customizable Vault connection options (address, port, token, protocol)
Error handling with detailed Vault status codes
use coult::{Config, Vault};
use serde::Deserialize;
#[derive(Debug, Deserialize)]
struct Secret {
password: String,
}
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
let vault = Vault::new()
.address("localhost")
.protocol("http")
.token("imtokenbro")
.port(8200)
.secret_path("kv/data/test")
.build().await.unwrap();
let data = vault.get_secret::<Secret>().await.unwrap();
println!("{:?}", data)
}
Replace YourSecretStruct with your custom struct that implements serde::Deserialize.
The client returns detailed errors based on Vault HTTP status codes, such as:
If values are not explicitly set in the builder, these environment variables will be used as defaults:
Contributions are welcome! Please open issues or submit pull requests.