diff options
Diffstat (limited to 'common/rust/src/config.rs')
| -rw-r--r-- | common/rust/src/config.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/common/rust/src/config.rs b/common/rust/src/config.rs index c158a21..bd12350 100644 --- a/common/rust/src/config.rs +++ b/common/rust/src/config.rs @@ -2,8 +2,7 @@ use std::env; use config::{Config, ConfigError, Environment, File}; use log::info; -use serde::{Deserialize}; - +use serde::Deserialize; #[derive(Debug, Deserialize, Clone)] #[serde(bound(deserialize = "T: Deserialize<'de> + std::default::Default + Clone"))] @@ -14,7 +13,10 @@ pub struct Settings<T> { pub nats: crate::nats::NatsConfiguration, } -impl<T> Settings<T> where T: Deserialize<'static> + std::default::Default + Clone { +impl<T> Settings<T> +where + T: Deserialize<'static> + std::default::Default + Clone, +{ pub fn new(service_name: &str) -> Result<Settings<T>, ConfigError> { let mut default = Config::default(); // this file my be shared with all the components @@ -30,7 +32,7 @@ impl<T> Settings<T> where T: Deserialize<'static> + std::default::Default + Clon let mut config: Settings<T> = default.clone().try_into().unwrap(); // try to load the config - config.config = default.get::<T>(&service_name).unwrap(); + config.config = default.get::<T>(service_name).unwrap(); pretty_env_logger::init(); // start the monitoring system if needed |
