diff --git a/core/src/main.rs b/core/src/main.rs index 5bdd99e..75416d3 100644 --- a/core/src/main.rs +++ b/core/src/main.rs @@ -11,10 +11,8 @@ pub const DATABASE_FILE: &str = "homedisk.db"; #[tokio::main] async fn main() { - // initialize logger logger::init(); - // parse config let config = Config::parse().expect("parse config"); // open database connection diff --git a/types/src/config/mod.rs b/types/src/config/mod.rs index 164a40d..66508a9 100644 --- a/types/src/config/mod.rs +++ b/types/src/config/mod.rs @@ -1,6 +1,6 @@ //! # Configuration file //! -//! Path to a config file is `config.toml` in the system configuration directory (`~/.config/homedisk/config.toml`). +//! Path to a config file is `config.toml` in the work directory. //! //! ## Example config //! diff --git a/types/src/config/types.rs b/types/src/config/types.rs index b897958..9ee7d61 100644 --- a/types/src/config/types.rs +++ b/types/src/config/types.rs @@ -45,16 +45,11 @@ impl Config { /// /// let config = Config::parse().unwrap(); /// ``` - pub fn parse() -> anyhow::Result { - // get path to the user's config directory - let sys_config_dir = dirs::config_dir().unwrap(); - // path to the homedisk config file - let config_path = format!("{}/homedisk/config.toml", sys_config_dir.to_string_lossy()); + pub fn parse() -> anyhow::Result { + let config_str = fs::read_to_string("config.toml")?; - // read file content to string - let config = fs::read_to_string(config_path)?; + let config = toml::from_str(&config_str)?; - // parse config and return it - Ok(toml::from_str(&config)?) + Ok(config) } }