/* This file is part of jellything (https://codeberg.org/metamuffin/jellything) which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2023 metamuffin */ #![feature(lazy_cell)] use database::Database; use federation::Federation; use jellycommon::config::GlobalConfig; use jellyremuxer::RemuxerContext; use log::error; use once_cell::sync::Lazy; use routes::build_rocket; use std::fs::File; pub mod database; pub mod federation; pub mod import; pub mod routes; pub static CONF: Lazy = Lazy::new(|| serde_json::from_reader(File::open("data/config.json").unwrap()).unwrap()); fn main() { env_logger::builder() .filter_level(log::LevelFilter::Info) .parse_env("LOG") .init(); #[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(); let federation = Federation::initialize(); database.create_admin(); // if let Err(err) = import::import(&database, &federation).await { // error!("import not sucessful: {err:?}") // } build_rocket(remuxer, database, federation) .launch() .await .unwrap(); }