/* 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) 2024 metamuffin */ #![feature(lazy_cell)] pub mod cache; pub mod database; pub mod federation; pub mod permission; pub mod assetfed; use jellycommon::config::{GlobalConfig, SecretsConfig}; use std::{fs::File, sync::LazyLock}; pub static CONF: LazyLock = LazyLock::new(|| { serde_yaml::from_reader( File::open(std::env::var("JELLYTHING_CONFIG").unwrap_or_else(|_| { if std::env::args() .nth(0) .unwrap_or_default() .ends_with("jellything") { std::env::args().nth(1).expect( "First argument or JELLYTHING_CONFIG must specify the configuration to use.", ) } else { panic!("JELLYTHING_CONFIG variable is required.") } })) .expect("config cannot be read"), ) .expect("config invalid") }); pub static SECRETS: LazyLock = LazyLock::new(|| { serde_yaml::from_reader(File::open(&CONF.secrets_path).expect("secrets file missing")) .expect("secrets config invalid") });