aboutsummaryrefslogtreecommitdiff
path: root/base/src/lib.rs
blob: 55a992711f601707adb854c6bff08924a46c5782 (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
/*
    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) 2025 metamuffin <metamuffin.org>
*/
pub mod assetfed;
pub mod database;
pub mod federation;
pub mod permission;

pub use jellycommon as common;
use serde::{Deserialize, Serialize};
use std::sync::LazyLock;
use std::sync::Mutex;

#[rustfmt::skip]
#[derive(Debug, Deserialize, Serialize, Default)]
pub struct Config {
  asset_key: Option<String>,
}

pub static CONF_PRELOAD: Mutex<Option<Config>> = Mutex::new(None);
static CONF: LazyLock<Config> = LazyLock::new(|| {
    CONF_PRELOAD
        .lock()
        .unwrap()
        .take()
        .expect("cache config not preloaded. logic error")
});