| Crates.io | redisctl-config |
| lib.rs | redisctl-config |
| version | 0.2.2 |
| created_at | 2025-10-27 14:45:19.704028+00 |
| updated_at | 2026-01-23 19:55:08.850404+00 |
| description | Configuration and profile management for Redis CLI tools |
| homepage | https://github.com/redis-developer/redisctl |
| repository | https://github.com/redis-developer/redisctl |
| max_upload_size | |
| id | 1903057 |
| size | 81,407 |
Configuration and profile management for Redis CLI tools.
This library provides a reusable configuration and profile system for managing credentials and settings for Redis Cloud and Redis Enterprise deployments.
Add this to your Cargo.toml:
[dependencies]
redisctl-config = "0.1"
# Optional: Enable secure credential storage
redisctl-config = { version = "0.1", features = ["secure-storage"] }
use redisctl_config::{Config, Profile, DeploymentType, ProfileCredentials};
// Load configuration from standard location
let config = Config::load()?;
// Create a new Cloud profile
let profile = Profile {
deployment_type: DeploymentType::Cloud,
credentials: ProfileCredentials::Cloud {
api_key: "your-api-key".to_string(),
api_secret: "your-secret".to_string(),
api_url: "https://api.redislabs.com/v1".to_string(),
},
files_api_key: None,
};
// Add profile to config
let mut config = Config::default();
config.set_profile("production".to_string(), profile);
config.save()?;
// Resolve which profile to use for Cloud operations
let profile_name = config.resolve_cloud_profile(None)?;
let profile = config.profiles.get(&profile_name).unwrap();
// Get credentials with keyring support
if let Some((api_key, api_secret, api_url)) = profile.resolve_cloud_credentials()? {
println!("API URL: {}", api_url);
}
use redisctl_config::CredentialStore;
let store = CredentialStore::new();
// Store credential in keyring (requires secure-storage feature)
#[cfg(feature = "secure-storage")]
let reference = store.store_credential("my-key", "secret-value")?;
// Retrieve credential (with environment variable fallback)
let value = store.get_credential("${MY_VAR}", Some("MY_VAR"))?;
Credentials can reference environment variables in the config file:
[profiles.production]
deployment_type = "cloud"
api_key = "${REDIS_CLOUD_API_KEY}"
api_secret = "${REDIS_CLOUD_SECRET_KEY}"
api_url = "${REDIS_CLOUD_API_URL:-https://api.redislabs.com/v1}"
The config file is automatically placed in platform-specific locations:
~/.config/redisctl/config.toml~/Library/Application Support/com.redis.redisctl/config.toml%APPDATA%\redis\redisctl\config.tomlLicensed under either of Apache License, Version 2.0 or MIT license at your option.