]> git.bitcoin.ninja Git - rapid-gossip-sync-server/commitdiff
Lowercase network values
authorAndrei <andrei.i@posteo.de>
Wed, 8 Feb 2023 00:00:00 +0000 (00:00 +0000)
committerAndrei <andrei.i@posteo.de>
Wed, 8 Feb 2023 00:00:00 +0000 (00:00 +0000)
README.md
src/config.rs

index 683efd747d9e04adc0801ec89a74c8e5a7251ed5..13f46c6a561dbad062c9f0496ebeedaa8c45899f 100644 (file)
--- 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                                                           |
index 475d63a316e65adecbe274d4a574730e0b442ff6..1f968d6418760b880cd1db6862ecf892b9446dc7 100644 (file)
@@ -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"),
        }
 }