From: Andrei Date: Wed, 8 Feb 2023 00:00:00 +0000 (+0000) Subject: Lowercase network values X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=192da4ef60a32e9cd4f65e63fe66b16d684a091b;p=rapid-gossip-sync-server Lowercase network values --- diff --git a/README.md b/README.md index 683efd7..13f46c6 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ can be made by setting environment variables, whose usage is as follows: | RAPID_GOSSIP_SYNC_SERVER_DB_USER | alice | Username to access Postgres | | RAPID_GOSSIP_SYNC_SERVER_DB_PASSWORD | _None_ | Password to access Postgres | | RAPID_GOSSIP_SYNC_SERVER_DB_NAME | ln_graph_sync | Name of the database to be used for gossip storage | +| RAPID_GOSSIP_SYNC_SERVER_NETWORK | mainnet | Network to operate in. Possible values are mainnet, testnet, signet, regtest | | BITCOIN_REST_DOMAIN | 127.0.0.1 | Domain of the [bitcoind REST server](https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md) | | BITCOIN_REST_PORT | 8332 | HTTP port of the bitcoind REST server | | BITCOIN_REST_PATH | /rest/ | Path infix to access the bitcoind REST endpoints | diff --git a/src/config.rs b/src/config.rs index 475d63a..1f968d6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -19,12 +19,13 @@ pub(crate) const SNAPSHOT_CALCULATION_INTERVAL: u32 = 3600 * 24; // every 24 hou pub(crate) const DOWNLOAD_NEW_GOSSIP: bool = true; pub(crate) fn network() -> Network { - let network = env::var("RAPID_GOSSIP_SYNC_SERVER_NETWORK").unwrap_or("Bitcoin".to_string()); + let network = env::var("RAPID_GOSSIP_SYNC_SERVER_NETWORK").unwrap_or("bitcoin".to_string()).to_lowercase(); match network.as_str() { - "Bitcoin" => Network::Bitcoin, - "Testnet" => Network::Testnet, - "Signet" => Network::Signet, - "Regtest" => Network::Regtest, + "mainnet" => Network::Bitcoin, + "bitcoin" => Network::Bitcoin, + "testnet" => Network::Testnet, + "signet" => Network::Signet, + "regtest" => Network::Regtest, _ => panic!("Invalid network"), } }