mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-27 16:19:59 -07:00
global: snapshot
This commit is contained in:
@@ -10,6 +10,10 @@ pub struct Config {
|
||||
#[arg(long, value_name = "DIR")]
|
||||
pub datadir: Option<String>,
|
||||
|
||||
/// Bitcoin RPC ip, default: localhost, saved
|
||||
#[arg(long, value_name = "IP")]
|
||||
pub rpcconnect: Option<String>,
|
||||
|
||||
/// Bitcoin RPC port, default: 8332, saved
|
||||
#[arg(long, value_name = "PORT")]
|
||||
pub rpcport: Option<u16>,
|
||||
@@ -42,6 +46,12 @@ impl Config {
|
||||
config_saved.datadir = Some(datadir);
|
||||
}
|
||||
|
||||
if let Some(rpcconnect) = config_args.rpcconnect {
|
||||
config_saved.rpcconnect = Some(rpcconnect);
|
||||
} else {
|
||||
config_saved.rpcconnect = Some("localhost".to_string())
|
||||
}
|
||||
|
||||
if let Some(rpcport) = config_args.rpcport {
|
||||
config_saved.rpcport = Some(rpcport);
|
||||
} else {
|
||||
|
||||
@@ -4,7 +4,11 @@ use crate::Config;
|
||||
|
||||
pub fn create_rpc(config: &Config) -> color_eyre::Result<Client> {
|
||||
Ok(Client::new(
|
||||
&format!("http://localhost:{}", config.rpcport.unwrap()),
|
||||
&format!(
|
||||
"http://{}:{}",
|
||||
config.rpcconnect.as_ref().unwrap(),
|
||||
config.rpcport.unwrap()
|
||||
),
|
||||
Auth::UserPass(
|
||||
config.rpcuser.clone().unwrap(),
|
||||
config.rpcpassword.clone().unwrap(),
|
||||
|
||||
Reference in New Issue
Block a user