diff options
| author | Matthieu <matthieu@developershouse.xyz> | 2021-10-08 14:48:39 +0400 |
|---|---|---|
| committer | Matthieu <matthieu@developershouse.xyz> | 2021-10-08 14:48:39 +0400 |
| commit | a02b25f235ba6eff33c6fd965c97071d5f112b6d (patch) | |
| tree | 2fc18dbde0f1b2403cb83cf1adb6aa5e66cef7b2 /common/rust/src/config.rs | |
| parent | 308df902d6ff8656cea13e61e5277890d5ad4f08 (diff) | |
changes in the proto names, and new spec for nats
Diffstat (limited to 'common/rust/src/config.rs')
| -rw-r--r-- | common/rust/src/config.rs | 8 |
1 files changed, 7 insertions, 1 deletions
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<T> 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<T> { @@ -13,10 +16,13 @@ pub struct Settings<T> { pub nats: crate::nats::NatsConfiguration, } +/// impl<T> Settings<T> 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<Settings<T>, ConfigError> { let mut default = Config::default(); // this file my be shared with all the components |
