diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs index 595ce3b..93397fa 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -46,21 +46,21 @@ | |||
46 | #![warn(clippy::all, clippy::pedantic)] | 46 | #![warn(clippy::all, clippy::pedantic)] |
47 | #![allow(clippy::unused_async)] | 47 | #![allow(clippy::unused_async)] |
48 | 48 | ||
49 | mod block; | ||
50 | mod config; | ||
49 | mod custom_filters; | 51 | mod custom_filters; |
50 | mod db; | 52 | mod db; |
51 | mod handlers; | 53 | mod handlers; |
52 | mod routes; | 54 | mod routes; |
53 | mod block; | ||
54 | mod student; | 55 | mod student; |
55 | mod config; | ||
56 | 56 | ||
57 | use crate::config::Config; | ||
57 | pub use block::{Fingerprint, Id}; | 58 | pub use block::{Fingerprint, Id}; |
58 | use db::Db; | 59 | use db::Db; |
59 | use lazy_static::lazy_static; | 60 | use lazy_static::lazy_static; |
61 | use log::error; | ||
60 | use std::fs; | 62 | use std::fs; |
61 | use crate::config::Config; | 63 | use warp::Filter; |
62 | use warp::{Filter}; | ||
63 | use log::{error}; | ||
64 | 64 | ||
65 | #[tokio::main] | 65 | #[tokio::main] |
66 | async fn main() { | 66 | async fn main() { |
@@ -73,13 +73,11 @@ async fn main() { | |||
73 | args.push("config.yaml".to_string()); | 73 | args.push("config.yaml".to_string()); |
74 | } | 74 | } |
75 | 75 | ||
76 | let combined_routes = args.into_iter() | 76 | let combined_routes = args |
77 | .into_iter() | ||
77 | .skip(1) // Skip the program name | 78 | .skip(1) // Skip the program name |
78 | .filter_map(|filename| { | 79 | .filter_map(|filename| { |
79 | match Config::read(&filename) { | 80 | Config::read(&filename).map(|config| routes::network(Db::new(config))) |
80 | Some(config) => Some(routes::network(Db::new(config))), | ||
81 | None => None, | ||
82 | } | ||
83 | }) | 81 | }) |
84 | .reduce(|routes, route| routes.or(route).unify().boxed()); | 82 | .reduce(|routes, route| routes.or(route).unify().boxed()); |
85 | 83 | ||
@@ -89,7 +87,7 @@ async fn main() { | |||
89 | // Exit the program if there's no successfully loaded config file. | 87 | // Exit the program if there's no successfully loaded config file. |
90 | error!("Failed to load any config files!"); | 88 | error!("Failed to load any config files!"); |
91 | return; | 89 | return; |
92 | }, | 90 | } |
93 | }; | 91 | }; |
94 | 92 | ||
95 | // gradecoin-site (zola) outputs a public/, we serve it here | 93 | // gradecoin-site (zola) outputs a public/, we serve it here |