fix
This commit is contained in:
parent
b4df75dcb6
commit
3eea2be3e8
1 changed files with 25 additions and 1 deletions
26
src/main.rs
26
src/main.rs
|
@ -74,6 +74,30 @@ macro_rules! get_locations {
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
pub static FLOW_INFO: OnceCell<JSONStore<FlowInfo>> = OnceCell::const_new();
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! get_flows {
|
||||
() => {
|
||||
if let Some(client) = $crate::FLOW_INFO.get() {
|
||||
client
|
||||
} else {
|
||||
let mut flows: $crate::json_store::JSONStore<$crate::flow::FlowInfo> =
|
||||
$crate::JSONStore::new("./flows");
|
||||
|
||||
let flow_keys: Vec<_> = flows.keys().cloned().collect();
|
||||
for flow_key in flow_keys {
|
||||
let flow = flows.get_mut(&flow_key).unwrap();
|
||||
flow.id = flow_key.clone();
|
||||
}
|
||||
|
||||
$crate::FLOW_INFO.set(flows).unwrap();
|
||||
$crate::FLOW_INFO.get().unwrap()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// ░░░░░░░░░░▀▀▀██████▄▄▄░░░░░░░░░░
|
||||
// ░░░░░░░░░░░░░░░░░▀▀▀████▄░░░░░░░
|
||||
// ░░░░░░░░░░▄███████▀░░░▀███▄░░░░░
|
||||
|
@ -113,7 +137,7 @@ async fn rocket() -> _ {
|
|||
let config = config::get_config();
|
||||
let itemdb = get_itemdb!().clone();
|
||||
let locations = get_locations!().clone();
|
||||
let flows: JSONStore<FlowInfo> = JSONStore::new("./flows");
|
||||
let flows = get_flows!().clone();
|
||||
integrity::verify_integrity(&config, &flows, &locations, &itemdb).await;
|
||||
|
||||
rocket::build()
|
||||
|
|
Loading…
Reference in a new issue