Skip to content

Commit 195353e

Browse files
authored
add specific config flag for bitcoin network (#376)
1 parent a287f13 commit 195353e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The following options are available:
1111
* `DATA_DIR` - the data directory root (default: ".")
1212
* `SURREAL_DB_CONNECTION` - the surreal DB connection (default: "ws://localhost:8800") - set to `rocksdb://data/surreal` for embedded mode
1313
* `TERMINAL_CLIENT` - whether to start a debug terminal client (default: false)
14-
* `ENVIRONMENT` - environment to start the app in (default: development)
14+
* `BITCOIN_NETWORK` - bitcoin network to use (default: testnet), possible values: `mainnet`, `regtest` and `testnet`
1515
* `RUST_LOG` - the log level, e.g.: info, trace, debug, error (default: error)
1616
* `NOSTR_RELAY` - nostr relay endpoint (default: ws://localhost:8080)
1717
* `MINT_URL` - cashu mint endpoint (default: https://moksha.minibill.tech)

src/config.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ pub struct Config {
2525
pub surreal_db_connection: String,
2626
#[arg(default_value_t = false, long, env = "TERMINAL_CLIENT")]
2727
pub terminal_client: bool,
28-
#[arg(default_value_t = String::from("development"), env = "development")]
29-
pub environment: String,
28+
#[arg(default_value_t = String::from("bitcoin_network"), env = "BITCOIN_NETWORK")]
29+
pub bitcoin_network: String,
3030
#[arg(default_value_t = String::from("ws://localhost:8080"), long, env = "NOSTR_RELAY")]
3131
pub nostr_relay: String,
3232
#[arg(default_value_t = String::from("https://moksha.minibill.tech"), long, env = "MINT_URL")]
@@ -60,9 +60,10 @@ impl Config {
6060
}
6161

6262
pub fn bitcoin_network(&self) -> Network {
63-
match self.environment.as_str() {
64-
"production" => Network::Bitcoin,
65-
"development" => Network::Testnet,
63+
match self.bitcoin_network.as_str() {
64+
"mainnet" => Network::Bitcoin,
65+
"testnet" => Network::Testnet,
66+
"regtest" => Network::Regtest,
6667
_ => Network::Testnet,
6768
}
6869
}

0 commit comments

Comments
 (0)