diff options
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/config.rs b/src/config.rs index 439c17c..13dd0e4 100644 --- a/src/config.rs +++ b/src/config.rs | |||
@@ -1,5 +1,6 @@ | |||
1 | use config::{File, Map}; | 1 | use config::{File, Map}; |
2 | use serde::{Deserialize, Serialize}; | 2 | use serde::{Deserialize, Serialize}; |
3 | use tracing::{debug, trace}; | ||
3 | 4 | ||
4 | #[derive(Debug, Serialize, Deserialize)] | 5 | #[derive(Debug, Serialize, Deserialize)] |
5 | #[serde(default)] | 6 | #[serde(default)] |
@@ -27,11 +28,15 @@ impl Default for Config { | |||
27 | 28 | ||
28 | impl Config { | 29 | impl Config { |
29 | pub fn load() -> Result<Self, config::ConfigError> { | 30 | pub fn load() -> Result<Self, config::ConfigError> { |
31 | debug!("load config"); | ||
30 | let config = config::Config::builder() | 32 | let config = config::Config::builder() |
31 | .add_source(File::with_name("config.toml").required(false)) | 33 | .add_source(File::with_name("config.toml").required(false)) |
32 | .add_source(config::Environment::with_prefix("FXBAUP").separator("_")) | 34 | .add_source(config::Environment::with_prefix("FXBAUP").separator("_")) |
33 | .build()?; | 35 | .build()?; |
34 | 36 | ||
35 | config.try_deserialize() | 37 | let cfg = config.try_deserialize(); |
38 | trace!(?cfg, "loaded config"); | ||
39 | |||
40 | cfg | ||
36 | } | 41 | } |
37 | } | 42 | } |