use env_proxy::for_url_str;
use ureq::{Agent, AgentBuilder, Proxy};
pub(crate) mod connect;
pub(crate) mod cross;
pub(crate) mod get;
pub(crate) mod init;
pub(crate) mod install;
pub(crate) mod new;
pub(crate) mod package;
pub(crate) mod pgx;
pub(crate) mod run;
pub(crate) mod schema;
pub(crate) mod start;
pub(crate) mod status;
pub(crate) mod stop;
pub(crate) mod test;
pub(crate) mod version;
pub(self) fn build_agent_for_url(url: &str) -> eyre::Result<Agent> {
if let Some(proxy_url) = for_url_str(url).to_string() {
Ok(AgentBuilder::new().proxy(Proxy::new(proxy_url)?).build())
} else {
Ok(Agent::new())
}
}