diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 65b4430..be109d0 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -43,11 +43,17 @@ use log::{error}; | |||
43 | async fn main() { | 43 | async fn main() { |
44 | log4rs::init_file("log.conf.yml", log4rs::config::Deserializers::default()).unwrap(); | 44 | log4rs::init_file("log.conf.yml", log4rs::config::Deserializers::default()).unwrap(); |
45 | 45 | ||
46 | let configs = vec!["config.yaml"]; | 46 | let mut args: Vec<String> = std::env::args().collect(); |
47 | 47 | ||
48 | let combined_routes = configs.into_iter() | 48 | if args.len() == 1 { |
49 | // config.yaml is the default configuration file | ||
50 | args.push("config.yaml".to_string()); | ||
51 | } | ||
52 | |||
53 | let combined_routes = args.into_iter() | ||
54 | .skip(1) // Skip the program name | ||
49 | .filter_map(|filename| { | 55 | .filter_map(|filename| { |
50 | match Config::read(filename) { | 56 | match Config::read(&filename) { |
51 | Some(config) => Some(routes::network(Db::new(config))), | 57 | Some(config) => Some(routes::network(Db::new(config))), |
52 | None => None, | 58 | None => None, |
53 | } | 59 | } |