| Crates.io | lmrc-vault |
| lib.rs | lmrc-vault |
| version | 0.3.15 |
| created_at | 2025-12-11 13:15:13.030087+00 |
| updated_at | 2025-12-11 13:19:40.650256+00 |
| description | HashiCorp Vault management library for the LMRC Stack - comprehensive library for managing Vault installations and secrets on K3s/Kubernetes clusters |
| homepage | https://gitlab.com/lemarco/lmrc-stack/tree/main/libs/vault-manager |
| repository | https://gitlab.com/lemarco/lmrc-stack |
| max_upload_size | |
| id | 1979646 |
| size | 132,161 |
HashiCorp Vault management library for the LMRC Stack - comprehensive library for managing Vault installations on Kubernetes/K3s clusters and interacting with the Vault API for secret management.
Add this to your Cargo.toml:
[dependencies]
lmrc-vault = "0.1.0"
use lmrc_vault::{VaultClient, VaultConfig, SecretOperations};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create Vault client configuration
let config = VaultConfig::builder()
.address("https://vault.example.com:8200")
.token("hvs.CAESIJ...")
.build()?;
// Create client
let client = VaultClient::new(config)?;
// Write a secret
client.write_secret(
"secret/data/myapp/config",
&[("db_password", "secure_pass"), ("api_key", "key123")]
).await?;
// Read a secret
let secret = client.read_secret("secret/data/myapp/config").await?;
println!("Database password: {}", secret.get("db_password").unwrap());
Ok(())
}
use lmrc_vault::{VaultDeployment, VaultDeploymentConfig};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Configure deployment
let config = VaultDeploymentConfig::builder()
.namespace("vault")
.replicas(3)
.storage_size("10Gi")
.enable_ui(true)
.build()?;
// Create deployment manager
let deployment = VaultDeployment::new(
"192.168.1.100",
"root",
config
);
// Deploy Vault via Helm
deployment.deploy()?;
// Initialize Vault (generates root token and unseal keys)
let init_result = deployment.initialize(5, 3)?;
println!("Root token: {}", init_result.root_token);
// Unseal Vault cluster
deployment.unseal(&init_result.unseal_keys[0..3])?;
Ok(())
}
For detailed usage examples, configuration options, and best practices, see the full documentation.
The library uses Vault's KV v2 engine path format: mount/data/secret-path
Example: secret/data/myapp/database/credentials
# Build
cargo build -p lmrc-vault
# Test
cargo test -p lmrc-vault
# Lint
cargo clippy -p lmrc-vault -- -D warnings
Dual licensed under MIT OR Apache-2.0
https://gitlab.com/lemarco/lmrc-stack
Lemarc lemarc.dev@gmail.com