diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-02-19 12:44:54 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-02-19 12:44:54 +0100 |
| commit | b732b3022e931cd49ebee64fa140aeec3ae55cbc (patch) | |
| tree | bc87d4ac8670ade2ee31fa7a470916cd8d5eaec1 /logic/src/lib.rs | |
| parent | a197ab4dc250311255056d4b36a6da8653e1040c (diff) | |
| download | jellything-b732b3022e931cd49ebee64fa140aeec3ae55cbc.tar jellything-b732b3022e931cd49ebee64fa140aeec3ae55cbc.tar.bz2 jellything-b732b3022e931cd49ebee64fa140aeec3ae55cbc.tar.zst | |
remove old logic crate
Diffstat (limited to 'logic/src/lib.rs')
| -rw-r--r-- | logic/src/lib.rs | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/logic/src/lib.rs b/logic/src/lib.rs deleted file mode 100644 index 7a1bf46..0000000 --- a/logic/src/lib.rs +++ /dev/null @@ -1,59 +0,0 @@ -/* - 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) 2026 metamuffin <metamuffin.org> -*/ -#![feature(duration_constructors)] - -pub mod assets; -pub mod filter_sort; -pub mod home; -pub mod items; -pub mod login; -pub mod node; -pub mod permission; -pub mod session; -pub mod stats; - -use anyhow::Context; -use anyhow::Result; -use serde::{Deserialize, Serialize}; -use std::path::PathBuf; -use std::sync::LazyLock; -use std::sync::Mutex; - -#[rustfmt::skip] -#[derive(Debug, Deserialize, Serialize, Default)] -pub struct Config { - login_expire: i64, - session_key: Option<String>, - admin_username:Option<String>, - admin_password:Option<String>, - database_path: PathBuf, -} - -pub static CONF_PRELOAD: Mutex<Option<Config>> = Mutex::new(None); -static CONF: LazyLock<Config> = LazyLock::new(|| { - CONF_PRELOAD - .lock() - .unwrap() - .take() - .expect("logic config not preloaded. logic error") -}); - -static DATABASE_PRELOAD: Mutex<Option<Database>> = Mutex::new(None); -static DATABASE: LazyLock<Database> = LazyLock::new(|| { - DATABASE_PRELOAD - .lock() - .unwrap() - .take() - .expect("database not preloaded. logic error") -}); - -pub fn init_database() -> Result<()> { - let database = Database::open(&CONF.database_path) - .context("opening database") - .unwrap(); - *DATABASE_PRELOAD.lock().unwrap() = Some(database); - Ok(()) -} |