mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-09 23:12:40 -04:00
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.
This commit is contained in:
parent
62c9f22b64
commit
0ca511bf8a
2 changed files with 96 additions and 77 deletions
|
@ -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")]
|
||||
pub piconeros: Option<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,
|
||||
|
||||
/// Run the swap as Bob and try to swap this many BTC (in satoshi).
|
||||
#[structopt(long = "sats")]
|
||||
pub satoshis: Option<u64>,
|
||||
#[structopt(default_value = "127.0.0.1", long = "listen_addr")]
|
||||
listen_addr: String,
|
||||
|
||||
/// Alice's onion multitaddr (only required for Bob, Alice will autogenerate
|
||||
/// one)
|
||||
#[structopt(long)]
|
||||
pub alice_address: Option<String>,
|
||||
#[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")]
|
||||
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 = "/ip4/127.0.0.1/tcp/9876", long = "dial")]
|
||||
// alice_addr: String,
|
||||
#[cfg(feature = "tor")]
|
||||
#[structopt(long = "tor")]
|
||||
tor_port: u16,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue