switch from static mut
config to using Rocket's State
This commit is contained in:
parent
f2b559ab5f
commit
01c9984d99
6 changed files with 61 additions and 135 deletions
16
src/lib.rs
16
src/lib.rs
|
@ -8,11 +8,19 @@ use rocket::{self};
|
|||
|
||||
/// Runs the server
|
||||
pub async fn run(conf: data::Config) -> Result<bool, rocket::Error> {
|
||||
unsafe {
|
||||
api::CONFIG = Some(conf);
|
||||
}
|
||||
match rocket::build()
|
||||
.mount("/", rocket::routes![api::caps, api::search])
|
||||
.mount(
|
||||
"/",
|
||||
rocket::routes![
|
||||
api::caps,
|
||||
api::search,
|
||||
api::tv_search,
|
||||
api::movie_search,
|
||||
api::music_search,
|
||||
api::book_search
|
||||
],
|
||||
)
|
||||
.manage(conf)
|
||||
.launch()
|
||||
.await
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue