about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-09T14·57-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-09T14·57-0400
commit099125435fc5ada63365a94ca153c711e706e225 (patch)
treef64ef41264120d9b740e7a1819ea261fa1145c2d /scripts
parent98a423b75aa9061f0164c316f9d2481ce6d5e2f1 (diff)
download-from-binary-cache: add nix.conf options
Diffstat (limited to 'scripts')
-rw-r--r--scripts/download-from-binary-cache.pl.in10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/download-from-binary-cache.pl.in b/scripts/download-from-binary-cache.pl.in
index 37f8db0a9905..f062d17e6e94 100644
--- a/scripts/download-from-binary-cache.pl.in
+++ b/scripts/download-from-binary-cache.pl.in
@@ -10,9 +10,13 @@ use WWW::Curl::Multi;
 use strict;
 
 
-my @binaryCacheUrls = map { s/\/+$//; $_ } split(/ /, ($ENV{"NIX_BINARY_CACHES"} || ""));
+Nix::Config::readConfig;
 
-my $maxParallelRequests = 150;
+my @binaryCacheUrls = map { s/\/+$//; $_ } split(/ /,
+    ($ENV{"NIX_BINARY_CACHES"} // $Nix::Config::config{"binary-caches"} // "http://nixos.org/binary-cache"));
+
+my $maxParallelRequests = int($Nix::Config::config{"binary-caches-parallel-connections"} // 150);
+$maxParallelRequests = 1 if $maxParallelRequests < 1;
 
 my ($dbh, $insertNAR, $queryNAR, $insertNegativeNAR, $queryNegativeNAR);
 my %cacheIds;
@@ -22,7 +26,7 @@ my $activeRequests = 0;
 my $curlIdCount = 1;
 my %requests;
 my %scheduled;
-my $caBundle = $ENV{"CURL_CA_BUNDLE"} || $ENV{"OPENSSL_X509_CERT_FILE"};
+my $caBundle = $ENV{"CURL_CA_BUNDLE"} // $ENV{"OPENSSL_X509_CERT_FILE"};
 
 
 sub addRequest {