[pve-devel] [pve-network 1/5] sdn: add proxy support for api calls

Alexandre Derumier aderumier at odiso.com
Thu Jan 4 17:11:35 CET 2024


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 src/PVE/Network/SDN.pm | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
index 3af09b5..b8f27d9 100644
--- a/src/PVE/Network/SDN.pm
+++ b/src/PVE/Network/SDN.pm
@@ -264,10 +264,9 @@ sub api_request {
     my $req = HTTP::Request->new($method,$url, $headers, $encoded_data);
 
     my $ua = LWP::UserAgent->new(protocols_allowed => ['http', 'https'], timeout => 30);
-    my $proxy = undef;
-
-    if ($proxy) {
-        $ua->proxy(['http', 'https'], $proxy);
+    my $dccfg = PVE::Cluster::cfs_read_file('datacenter.cfg');
+    if ($dccfg->{http_proxy}) {
+	$ua->proxy(['http', 'https'], $dccfg->{http_proxy});
     } else {
         $ua->env_proxy;
     }
-- 
2.39.2




More information about the pve-devel mailing list