1 unstable release

0.1.0 Jul 18, 2023

#14 in #spring

MIT/Apache

7KB
74 lines

Spring Cloud Config Reader

This is a simple crate to read configurations from a Spring Cloud Config server.

Usage

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(())
}


lib.rs:

This crate is to read the configuration yaml file from the Spring Cloud Config service. Then deserialize them to a data object

Dependencies

~6–20MB
~296K SLoC