reth_rpc_api_testing_util/
utils.rs

1//! Utils for testing RPC.
2
3/// This will read the value of the given environment variable and parse it as a URL.
4///
5/// If the value has no http(s) scheme, it will be appended: `http://{var}`.
6pub fn parse_env_url(var: &str) -> Result<String, std::env::VarError> {
7    let var = std::env::var(var)?;
8    if var.starts_with("http") {
9        Ok(var)
10    } else {
11        Ok(format!("http://{var}"))
12    }
13}