feat: 代理设置同步到环境变量
Some checks are pending
Build Dev Image / build-dev-image (push) Waiting to run

This commit is contained in:
Junyan Qin 2024-11-11 19:12:30 +08:00
parent 805454e037
commit 0d4784d098
No known key found for this signature in database
GPG Key ID: 22FE3AFADC710CEB

View File

@ -25,10 +25,14 @@ class ProxyManager:
"https://": os.getenv("HTTPS_PROXY") or os.getenv("https_proxy"),
}
if 'http' in self.ap.system_cfg.data['network-proxies']:
if 'http' in self.ap.system_cfg.data['network-proxies'] and self.ap.system_cfg.data['network-proxies']['http']:
self.forward_proxies['http://'] = self.ap.system_cfg.data['network-proxies']['http']
if 'https' in self.ap.system_cfg.data['network-proxies']:
if 'https' in self.ap.system_cfg.data['network-proxies'] and self.ap.system_cfg.data['network-proxies']['https']:
self.forward_proxies['https://'] = self.ap.system_cfg.data['network-proxies']['https']
# 设置到环境变量
os.environ['HTTP_PROXY'] = self.forward_proxies['http://']
os.environ['HTTPS_PROXY'] = self.forward_proxies['https://']
def get_forward_proxies(self) -> dict:
return self.forward_proxies.copy()