global: snapshot

This commit is contained in:
k
2024-09-29 20:39:51 +02:00
parent e3b44b0adb
commit 9d2c2f7945
23 changed files with 2694 additions and 2054 deletions

View File

@@ -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 {

View File

@@ -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(),