diff options
author | metamuffin <metamuffin@disroot.org> | 2025-04-30 10:47:54 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-04-30 10:47:54 +0200 |
commit | a2ef3f6ec4c830611fde1a2e935588ccbbc61c03 (patch) | |
tree | ddcc1cb501e6c7237edd491aa7136d02150d03d3 /logic/src/lib.rs | |
parent | 212a0f23bc894faf88e159560c113f504349cc05 (diff) | |
download | jellything-a2ef3f6ec4c830611fde1a2e935588ccbbc61c03.tar jellything-a2ef3f6ec4c830611fde1a2e935588ccbbc61c03.tar.bz2 jellything-a2ef3f6ec4c830611fde1a2e935588ccbbc61c03.tar.zst |
config works
Diffstat (limited to 'logic/src/lib.rs')
-rw-r--r-- | logic/src/lib.rs | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/logic/src/lib.rs b/logic/src/lib.rs index 54c9c40..64656f5 100644 --- a/logic/src/lib.rs +++ b/logic/src/lib.rs @@ -3,14 +3,36 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2025 metamuffin <metamuffin.org> */ -#![feature(duration_constructors)] +#![feature(duration_constructors, let_chains)] +pub mod admin; pub mod filter_sort; pub mod home; +pub mod items; +pub mod login; pub mod node; pub mod search; pub mod session; pub mod stats; -pub mod items; -pub mod admin; -pub mod login; + +use serde::{Deserialize, Serialize}; +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>, +} + +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") +}); |