From a02b25f235ba6eff33c6fd965c97071d5f112b6d Mon Sep 17 00:00:00 2001 From: Matthieu Date: Fri, 8 Oct 2021 14:48:39 +0400 Subject: changes in the proto names, and new spec for nats --- common/rust/src/config.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'common/rust/src/config.rs') diff --git a/common/rust/src/config.rs b/common/rust/src/config.rs index d4437a9..3dcd72c 100644 --- a/common/rust/src/config.rs +++ b/common/rust/src/config.rs @@ -1,9 +1,12 @@ use std::env; - use config::{Config, ConfigError, Environment, File, Source}; use log::info; use serde::Deserialize; +/// Settings is the base structure for all the nova's component config +/// you can specify a type T and the name of the component. the "config" +/// field will be equals to the key named after the given component name +/// and will be of type T #[derive(Debug, Deserialize, Clone)] #[serde(bound(deserialize = "T: Deserialize<'de> + std::default::Default + Clone"))] pub struct Settings { @@ -13,10 +16,13 @@ pub struct Settings { pub nats: crate::nats::NatsConfiguration, } +/// impl Settings where T: Deserialize<'static> + std::default::Default + Clone, { + /// Initializes a new configuration like the other components of nova + /// And starts the prometheus metrics server if needed. pub fn new(service_name: &str) -> Result, ConfigError> { let mut default = Config::default(); // this file my be shared with all the components -- cgit v1.2.3