[pve-devel] [PATCH v2 pve-network 2/6] sdn: add proxy support for api calls

Alexandre Derumier aderumier at odiso.com
Tue Feb 13 09:48:54 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