blob: 29d51cacb08b4c68e67863664c49e7f1317f9d96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#![feature(box_syntax)]
use config::{load_global_config, GlobalConfig};
use database::Database;
use jellyremuxer::RemuxerContext;
use library::Library;
use once_cell::sync::Lazy;
use rocket::launch;
use routes::build_rocket;
use std::sync::Arc;
pub mod config;
pub mod database;
pub mod library;
pub mod routes;
pub struct AppState {
pub database: Database,
pub library: Library,
pub remuxer: Arc<RemuxerContext>,
}
pub static CONF: Lazy<GlobalConfig> = Lazy::new(|| load_global_config());
#[launch]
fn rocket() -> _ {
env_logger::builder()
.filter_level(log::LevelFilter::Info)
.parse_env("LOG")
.init();
let state = AppState {
remuxer: RemuxerContext::new(),
library: Library::open(&CONF.library_path).unwrap(),
database: Database::open(&CONF.database_path).unwrap(),
};
build_rocket(state)
}
|