Remove hardcoded configuration
The hardcoded configuration was replaced with CLI configuration options. CLI based config was chosen over a config file as it does not access and clutter the user's file system. By CLI options depend on whether the program is run in Alice or Bob mode.pull/34/head
parent
62c9f22b64
commit
0ca511bf8a
@ -1,19 +1,44 @@
|
||||
use libp2p::core::Multiaddr;
|
||||
use url::Url;
|
||||
|
||||
#[derive(structopt::StructOpt, Debug)]
|
||||
pub struct Options {
|
||||
/// Run the swap as Alice.
|
||||
#[structopt(long = "as-alice")]
|
||||
pub as_alice: bool,
|
||||
pub enum Options {
|
||||
Alice {
|
||||
/// Run the swap as Bob and try to swap this many BTC (in satoshi).
|
||||
#[structopt(long = "sats")]
|
||||
satoshis: u64,
|
||||
|
||||
// /// Run the swap as Bob and try to swap this many XMR (in piconero).
|
||||
// #[structopt(long = "picos", conflicts_with = "sats"))]
|
||||
// pub piconeros: u64,
|
||||
#[structopt(default_value = "http://127.0.0.1:8332", long = "bitcoind")]
|
||||
bitcoind_url: Url,
|
||||
|
||||
#[structopt(default_value = "127.0.0.1", long = "listen_addr")]
|
||||
listen_addr: String,
|
||||
|
||||
/// Run the swap as Bob and try to swap this many XMR (in piconero).
|
||||
#[structopt(long = "picos")]
|
||||
pub piconeros: Option<u64>,
|
||||
#[structopt(default_value = 9876, long = "list_port")]
|
||||
listen_port: u16,
|
||||
},
|
||||
Bob {
|
||||
/// Alice's multitaddr (only required for Bob, Alice will autogenerate
|
||||
/// one)
|
||||
#[structopt(long = "alice_addr")]
|
||||
alice_addr: Multiaddr,
|
||||
|
||||
/// Run the swap as Bob and try to swap this many BTC (in satoshi).
|
||||
#[structopt(long = "sats")]
|
||||
pub satoshis: Option<u64>,
|
||||
/// Run the swap as Bob and try to swap this many BTC (in satoshi).
|
||||
#[structopt(long = "sats")]
|
||||
satoshis: u64,
|
||||
|
||||
/// Alice's onion multitaddr (only required for Bob, Alice will autogenerate
|
||||
/// one)
|
||||
#[structopt(long)]
|
||||
pub alice_address: Option<String>,
|
||||
// /// Run the swap as Bob and try to swap this many XMR (in piconero).
|
||||
// #[structopt(long = "picos", conflicts_with = "sats"))]
|
||||
// pub piconeros: u64,
|
||||
#[structopt(default_value = "http://127.0.0.1:8332", long = "bitcoind")]
|
||||
bitcoind_url: Url,
|
||||
// #[structopt(default_value = "/ip4/127.0.0.1/tcp/9876", long = "dial")]
|
||||
// alice_addr: String,
|
||||
#[cfg(feature = "tor")]
|
||||
#[structopt(long = "tor")]
|
||||
tor_port: u16,
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue