add basic integrity check on startup
This commit is contained in:
parent
1271387131
commit
416c1f06c1
2 changed files with 88 additions and 6 deletions
10
src/main.rs
10
src/main.rs
|
@ -8,6 +8,7 @@ use rocket::{http::Method, launch};
|
|||
mod config;
|
||||
mod db;
|
||||
mod flow;
|
||||
mod integrity;
|
||||
mod item;
|
||||
mod json_store;
|
||||
mod location;
|
||||
|
@ -47,23 +48,20 @@ async fn rocket() -> _ {
|
|||
.to_cors()
|
||||
.expect("error creating CORS options");
|
||||
|
||||
let config = config::get_config();
|
||||
let itemdb = db::ItemDB::new("./itemdb").await;
|
||||
let mut locations: JSONStore<Location> = JSONStore::new("./locations");
|
||||
let mut flows: JSONStore<FlowInfo> = JSONStore::new("./flows");
|
||||
integrity::verify_integrity(&config, &flows, &locations, &itemdb).await;
|
||||
|
||||
for location in &mut *locations {
|
||||
location.1.add(location.0).await;
|
||||
}
|
||||
|
||||
let mut flows: JSONStore<FlowInfo> = JSONStore::new("./flows");
|
||||
|
||||
for flow in &mut *flows {
|
||||
flow.1.add(flow.0).await;
|
||||
}
|
||||
|
||||
let config = config::get_config();
|
||||
|
||||
// todo : log warnings on misconfiguration
|
||||
|
||||
rocket::build()
|
||||
.mount(
|
||||
"/",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue