default values for debug and info configuration params
@@ -63,7 +63,9 @@ impl Default for ConsensusConfig {
#[derive(Debug, Deserialize, Clone)]
pub struct Settings {
+ #[serde(default = "default_debug")]
pub debug: bool,
+ #[serde(default = "default_log_level")]
pub log_level: String,
pub storage: StorageConfig,
pub service: ServiceConfig,
@@ -71,6 +73,14 @@ pub struct Settings {
pub cluster: ClusterConfig,
}
+fn default_debug() -> bool {
+ false
+}
+
+fn default_log_level() -> String {
+ "INFO".to_string()
+}
+
fn default_timeout_ms() -> u64 {
1000
}
@@ -126,3 +136,15 @@ pub fn max_web_workers(settings: &Settings) -> usize {
max_workers.unwrap()
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_read_default_config() {
+ let key = "RUN_MODE";
+ env::set_var(key, "TEST");
+ Settings::new().unwrap();
+ }
+}
