Skip to content

Make download endpoint configurable #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 binaries 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
Expand Down
7 changes: 5 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down