switch from static mut config to using Rocket's State

This commit is contained in:
askiiart 2024-12-01 22:00:19 -06:00
parent f2b559ab5f
commit 01c9984d99
Signed by untrusted user who does not match committer: askiiart
GPG key ID: EA85979611654C30
6 changed files with 61 additions and 135 deletions

View file

@ -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
{