aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs20
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
49mod block;
50mod config;
49mod custom_filters; 51mod custom_filters;
50mod db; 52mod db;
51mod handlers; 53mod handlers;
52mod routes; 54mod routes;
53mod block;
54mod student; 55mod student;
55mod config;
56 56
57use crate::config::Config;
57pub use block::{Fingerprint, Id}; 58pub use block::{Fingerprint, Id};
58use db::Db; 59use db::Db;
59use lazy_static::lazy_static; 60use lazy_static::lazy_static;
61use log::error;
60use std::fs; 62use std::fs;
61use crate::config::Config; 63use warp::Filter;
62use warp::{Filter};
63use log::{error};
64 64
65#[tokio::main] 65#[tokio::main]
66async fn main() { 66async 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