Crates.io | sccc |
lib.rs | sccc |
version | 0.1.0 |
source | src |
created_at | 2023-07-18 08:21:07.872251 |
updated_at | 2023-07-18 08:21:07.872251 |
description | Spring Cloud Config Server Reader |
homepage | https://github.com/zenas0810/sccc |
repository | https://github.com/zenas0810/sccc |
max_upload_size | |
id | 919213 |
size | 17,190 |
This is a simple crate to read configurations from a Spring Cloud Config server.
use {sccc::{Result,
SCC},
serde::Deserialize};
#[derive(Debug, Clone, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
struct PUSConf {
pus: PUSApp,
}
#[derive(Debug, Clone, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
struct PUSApp {
supported_profile_items: Vec<String>,
}
#[tokio::test]
async fn test_scc() -> Result<()> {
let scc: SCC<PUSConf> = SCC::new("http://<username>:<password>@config.test2pay.com", "dev", "gp232_pus");
let _ = scc.load().await?;
let pus_conf = scc.get(|x| x.pus.clone()).await;
println!("{:?}", pus_conf);
Ok(())
}