use mesk::cfg::config::{Config, Log, Loglevel, Paths, Repo}; pub fn create_test_config(temp_dir_path: &str) -> Config { let cfg: Config = Config { repo: Repo { repo_url: format!(r"http://mesk.anthrill.i2p/repo/{}", std::env::consts::ARCH), repo_http_url: format!(r"http://mesk.anthrill.com/repo/{}", std::env::consts::ARCH) .into(), auto_update: true, destination: (String::from("mesk"), String::from("mesk")), }, log: Log { log_file: String::from("mesk.log"), log_level: Loglevel::Info, }, paths: Paths { cache_dir: String::from(temp_dir_path), build_dir: String::from(format!("{}/build", String::from(temp_dir_path))), installed_db: String::from(format!("{}/pkgdb", String::from(temp_dir_path))), }, }; // Export this config as TOML so runtime code can read it via MESK_CONFIG_TOML if let Ok(toml_str) = toml::to_string(&cfg) { unsafe { std::env::set_var("MESK_CONFIG_TOML", toml_str); } } cfg }