diff --git a/abstracttorrent b/abstracttorrent index 2b4cd84..e2f8edc 160000 --- a/abstracttorrent +++ b/abstracttorrent @@ -1 +1 @@ -Subproject commit 2b4cd84d7faf49d37492c6ff5708454beea7857a +Subproject commit e2f8edc61742ceaba929ad472cb76359795b04fc diff --git a/src/config/config.rs b/src/config/config.rs index 23f44ef..587b732 100644 --- a/src/config/config.rs +++ b/src/config/config.rs @@ -140,18 +140,30 @@ impl Into for LogLevel { impl Config { pub fn new() -> Self { // The path of the config file without the file extension - let path = match env::var("CROSS_SEED_CONFIG") { - Ok(path) => path, - Err(_) => "config".to_string(), + let path = { + let args: Vec = wild::args().collect(); + let (_args, argv) = argmap::parse(args.iter()); + + match argv.get("--config-path") { + Some(path) => { + println!("config path: {:?}", path); + path.first().unwrap().clone() + }, + None => match env::var("CROSS_SEED_CONFIG") { + Ok(path) => path, + Err(_) => "config.toml".to_string(), + } + } }; // TODO: Create a command line argument `Provider` (https://docs.rs/figment/0.10.6/figment/trait.Provider.html) // TODO: Figure out priority + // Merge the config files let figment = Figment::new() .join(CliProvider::new()) .join(Env::prefixed("CROSS_SEED_")) - .join(Toml::file(format!("{}.toml", path))); + .join(Toml::file(format!("{}", path))); let mut config: Config = figment.extract().unwrap();