diff --git a/src/main.rs b/src/main.rs index 1ec6bc4..fb3bc91 100644 --- a/src/main.rs +++ b/src/main.rs @@ -70,7 +70,7 @@ async fn main() -> color_eyre::Result<()> { let (tx, rx) = tokio::sync::mpsc::unbounded_channel(); let ui_task = tokio::task::spawn(ui_impl.run(tx.clone(), rx)); - let raw_config_path = raw_config::get_config_path().await; + let raw_config_path = raw_config::get_config_path(); let raw_config = raw_config::read_config(&raw_config_path) .await .wrap_err_with(move || format!("failed to read {raw_config_path}"))?; diff --git a/src/raw_config.rs b/src/raw_config.rs index b27a2d2..c693911 100644 --- a/src/raw_config.rs +++ b/src/raw_config.rs @@ -3,7 +3,7 @@ use std::{collections::HashSet, env, num::NonZero, path::PathBuf}; use color_eyre::eyre::WrapErr as _; use serde::{Deserialize, Deserializer}; -use crate::utils::{is_docker, is_http_url}; +use crate::utils::is_http_url; fn validate_positive_f64<'de, D: Deserializer<'de>>( deserializer: D, @@ -113,17 +113,10 @@ impl<'de> Deserialize<'de> for OutputConfig { } } -const CONFIG_ENV_VAR: &str = "PROXY_SCRAPER_CHECKER_CONFIG"; -const DEFAULT_CONFIG_PATH: &str = "config.toml"; +const CONFIG_ENV: &str = "PROXY_SCRAPER_CHECKER_CONFIG"; -pub async fn get_config_path() -> String { - if is_docker().await { - DEFAULT_CONFIG_PATH.to_owned() - } else if let Ok(config_path) = env::var(CONFIG_ENV_VAR) { - config_path - } else { - DEFAULT_CONFIG_PATH.to_owned() - } +pub fn get_config_path() -> String { + env::var(CONFIG_ENV).unwrap_or_else(|_| "config.toml".to_owned()) } pub async fn read_config(path: &str) -> color_eyre::Result {