From 02b008f450cc14bb28d6bd11b60a150478e17766 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Mon, 20 Feb 2023 12:10:46 -0600 Subject: [PATCH 1/2] Make download endpoint configurable --- README.md | 2 ++ build.rs | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f47aac9..a7e2c7d 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,8 @@ Then use it: let bitcoind = bitcoind::BitcoinD::new(bitcoind::downloaded_exe_path().unwrap()).unwrap(); ``` +When the `BITCOIND_DOWNLOAD_ENDPOINT` environment variable is set, `bitcoind` will try to download the biniaries from the given endpoint. Otherwise it defaults to `https://bitcoincore.org/bin/`. + ## MSRV The MSRV is 1.41.1 for version 0.29.* if no feature is used, otherwise is 1.57 diff --git a/build.rs b/build.rs index 2a8666f..7bd1283 100644 --- a/build.rs +++ b/build.rs @@ -108,9 +108,12 @@ mod download { download_filename, VERSION, expected_hash ); + let download_endpoint = std::env::var("BITCOIND_DOWNLOAD_ENDPOINT") + .unwrap_or("https://bitcoincore.org/bin/".to_owned()); + let url = format!( - "https://bitcoincore.org/bin/bitcoin-core-{}/{}", - VERSION, download_filename + "{}/bitcoin-core-{}/{}", + download_endpoint, VERSION, download_filename ); println!("url:{}", url); let mut downloaded_bytes = Vec::new(); From 56f232133241edd5e09048ebce21377534271890 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Tue, 28 Feb 2023 15:19:07 +0100 Subject: [PATCH 2/2] f Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a7e2c7d..099d995 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Then use it: let bitcoind = bitcoind::BitcoinD::new(bitcoind::downloaded_exe_path().unwrap()).unwrap(); ``` -When the `BITCOIND_DOWNLOAD_ENDPOINT` environment variable is set, `bitcoind` will try to download the biniaries from the given endpoint. Otherwise it defaults to `https://bitcoincore.org/bin/`. +When the `BITCOIND_DOWNLOAD_ENDPOINT` environment variable is set, `bitcoind` will try to download the binaries from the given endpoint. Otherwise it defaults to `https://bitcoincore.org/bin/`. ## MSRV