mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 21:37:41 +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},
|
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 PLAIN_CLIENT: OnceCell<reqwest::Client> = OnceCell::new();
|
||||||
static HTTPS_PROXY_CLIENT: OnceCell<reqwest::Client> = OnceCell::new();
|
static HTTPS_PROXY_CLIENT: OnceCell<reqwest::Client> = OnceCell::new();
|
||||||
static HTTP_PROXY_CLIENT: OnceCell<reqwest::Client> = OnceCell::new();
|
static HTTP_PROXY_CLIENT: OnceCell<reqwest::Client> = OnceCell::new();
|
||||||
@ -22,15 +19,9 @@ enum ProxyType {
|
|||||||
|
|
||||||
impl ProxyType {
|
impl ProxyType {
|
||||||
fn get_proxy_url(&self, proxy: &Proxy) -> Option<String> {
|
fn get_proxy_url(&self, proxy: &Proxy) -> Option<String> {
|
||||||
use std::env::var;
|
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
Self::Http => var(HTTP_PROXY)
|
Self::Http => proxy.http_url.clone(),
|
||||||
.or_else(|_| proxy.http_url.clone().ok_or(()))
|
Self::Https => proxy.https_url.clone(),
|
||||||
.ok(),
|
|
||||||
Self::Https => var(HTTPS_PROXY)
|
|
||||||
.or_else(|_| proxy.https_url.clone().ok_or(()))
|
|
||||||
.ok(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user