aboutsummaryrefslogtreecommitdiff
path: root/scripts/download-from-binary-cache.pl.in
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-09 10:57:28 -0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-09 10:57:28 -0400
commit099125435fc5ada63365a94ca153c711e706e225 (patch)
treef64ef41264120d9b740e7a1819ea261fa1145c2d /scripts/download-from-binary-cache.pl.in
parent98a423b75aa9061f0164c316f9d2481ce6d5e2f1 (diff)
download-from-binary-cache: add nix.conf options
Diffstat (limited to 'scripts/download-from-binary-cache.pl.in')
-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 37f8db0a9..f062d17e6 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 {