use lemmeknow::Identifier;
use once_cell::sync::OnceCell;
pub struct Config {
pub verbose: u8,
pub lemmeknow_config: Identifier,
pub human_checker_on: bool,
pub timeout: u32,
pub api_mode: bool,
pub regex: Option<String>,
}
static CONFIG: OnceCell<Config> = OnceCell::new();
pub fn set_global_config(config: Config) {
CONFIG.set(config).ok(); }
pub fn get_config() -> &'static Config {
CONFIG.get_or_init(Config::default)
}
const LEMMEKNOW_DEFAULT_CONFIG: Identifier = Identifier {
min_rarity: 0.0,
max_rarity: 0.0,
tags: vec![],
exclude_tags: vec![],
file_support: false,
boundaryless: false,
};
impl Default for Config {
fn default() -> Self {
Config {
verbose: 0,
lemmeknow_config: LEMMEKNOW_DEFAULT_CONFIG,
human_checker_on: false,
timeout: 5,
api_mode: true,
regex: None,
}
}
}