aboutsummaryrefslogtreecommitdiff
path: root/server/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/main.rs')
-rw-r--r--server/src/main.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/server/src/main.rs b/server/src/main.rs
index 341f72b..5b2d070 100644
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -5,13 +5,12 @@
*/
#![feature(lazy_cell)]
-use std::fs::File;
use database::Database;
use jellycommon::config::GlobalConfig;
use jellyremuxer::RemuxerContext;
use once_cell::sync::Lazy;
-use rocket::launch;
use routes::build_rocket;
+use std::fs::File;
pub mod database;
pub mod import;
@@ -20,8 +19,7 @@ pub mod routes;
pub static CONF: Lazy<GlobalConfig> =
Lazy::new(|| serde_json::from_reader(File::open("data/config.json").unwrap()).unwrap());
-#[launch]
-fn rocket() -> _ {
+fn main() {
env_logger::builder()
.filter_level(log::LevelFilter::Info)
.parse_env("LOG")
@@ -30,9 +28,16 @@ fn rocket() -> _ {
#[cfg(feature = "bypass-auth")]
log::warn!("authentification bypass enabled");
+ tokio::runtime::Builder::new_multi_thread()
+ .enable_all()
+ .build()
+ .unwrap()
+ .block_on(async_main())
+}
+async fn async_main() {
let remuxer = RemuxerContext::new();
let database = Database::open(&CONF.database_path).unwrap();
- import::import(&database).unwrap();
+ import::import(&database).await.unwrap();
database.create_admin();
- build_rocket(remuxer, database)
+ build_rocket(remuxer, database).launch().await.unwrap();
}