mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
refactor(client): remove dependence on ROUTER_HTTP_PROXY and ROUTER_HTTPS_PROXY env vars (#730)
This commit is contained in:
@ -8,9 +8,6 @@ use crate::{
|
||||
core::errors::{self, CustomResult},
|
||||
};
|
||||
|
||||
const HTTP_PROXY: &str = "ROUTER_HTTP_PROXY";
|
||||
const HTTPS_PROXY: &str = "ROUTER_HTTPS_PROXY";
|
||||
|
||||
static PLAIN_CLIENT: OnceCell<reqwest::Client> = OnceCell::new();
|
||||
static HTTPS_PROXY_CLIENT: OnceCell<reqwest::Client> = OnceCell::new();
|
||||
static HTTP_PROXY_CLIENT: OnceCell<reqwest::Client> = OnceCell::new();
|
||||
@ -22,15 +19,9 @@ enum ProxyType {
|
||||
|
||||
impl ProxyType {
|
||||
fn get_proxy_url(&self, proxy: &Proxy) -> Option<String> {
|
||||
use std::env::var;
|
||||
|
||||
match self {
|
||||
Self::Http => var(HTTP_PROXY)
|
||||
.or_else(|_| proxy.http_url.clone().ok_or(()))
|
||||
.ok(),
|
||||
Self::Https => var(HTTPS_PROXY)
|
||||
.or_else(|_| proxy.https_url.clone().ok_or(()))
|
||||
.ok(),
|
||||
Self::Http => proxy.http_url.clone(),
|
||||
Self::Https => proxy.https_url.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user