From 94c656ad40a7aae570e5a5fb61ad32632acc6d46 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 23 Aug 2024 13:11:09 +0200 Subject: feat(treewide): Use a configuration file This allows use to avoid duplication of default values in the codebase and obviously also facilitates changing these without having to re-compile. --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 7852aa0..a6766f6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ use app::App; use cache::invalidate; use clap::Parser; use cli::{CacheCommand, CheckCommand, SelectCommand, SubscriptionCommand}; +use config::Config; use log::info; use select::cmds::handle_select_cmd; use tokio::{ @@ -31,6 +32,7 @@ pub mod cli; pub mod cache; pub mod comments; +pub mod config; pub mod constants; pub mod download; pub mod select; @@ -54,7 +56,8 @@ async fn main() -> Result<()> { .init() .expect("Let's just hope that this does not panic"); - let app = App::new(args.db_path.unwrap_or(constants::database()?)).await?; + let config = Config::from_config_file(args.db_path, args.config_path)?; + let app = App::new(config).await?; match args.command.unwrap_or(Command::default()) { Command::Download { -- cgit 1.4.1