Storus
A library that simplifies the life of rust developers by abstracting the low level communication protocols (REST/gRPC)
when they want to use StooKV as their configurations management tool.

Usage
To use storus, include the dependency in your Cargo.toml as :
[dependencies]
storus = "0.1.1"
Next, add this to your crate:
use storus::stoo::Stoo;
use storus::stoo_config::StooConfig;
fn main() {
}
Examples
Create stoo client from minimal configurations:
use storus::stoo::Stoo;
use storus::stoo_config::StooConfig;
#[tokio::main]
async fn main() {
let config = StooConfig::from("http://localhost:50051");
let mut stookv = Stoo::new(config).await;
}
Create stoo client from extended configurations:
use crate::stoo::Stoo;
use crate::stoo_config::StooConfig;
#[tokio::main]
async fn main() {
let config = StooConfig::from("https://localhost:50051")
.response_timeout(Duration::from_millis(20000))
.connect_timeout(Duration::from_millis(1000))
.default_namespace("my-app")
.default_profile("prod")
.ca_certificate("/tmp/ca_cert.pem")
.domain("x.test.example.com");
let mut stookv = Stoo::new(config).await;
}
Complete example:
use storus::stoo::Stoo;
use storus::stoo_config::StooConfig;
#[tokio::main]
async fn main() {
let config = StooConfig::from("http://localhost:50051");
let mut stookv = Stoo::new(config).await;
let result1 = stookv.set("my-app", "prod", "database.username", "admin3").await.unwrap();
println!("result1: {}", result1);
let result2 = stookv.get("my-app", "prod", "database.username").await.unwrap();
println!("result2: {}", result2);
let result3 = stookv.get_all_by_namespace_and_profile("my-app", "prod").await.unwrap();
println!("result3: {:?}", result3);
let result4 = stookv.get_default("database.username").await.unwrap();
println!("result4: {}", result4);
let result5 = stookv.set_secret("my-app", "prod", "database.password", "qwerty@1234").await.unwrap();
println!("result5: {}", result5);
}
License
The project is licensed under MIT license.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in Storus by you, shall be licensed as MIT, without any additional
terms or conditions.