explorerd: add support for multiple networks (localnet, testnet, mainnet)

This update adds configuration support for multiple networks (localnet, testnet, and mainnet) to the explorer daemon, enabling provisioning of tailored instances for development, testing, and production environments.

Summary of Updates:
- Added `--network` argument to the binary crate args for specifying networks (localnet, testnet, and mainnet)
- Implemented a `config` module for configuration management
- Introduced `ExplorerConfig` and `ExplorerNetworkConfig` structures to model and work with the complete configuration file programmatically in Rust
- Implemented `TryFrom` traits for configuration conversions
- Added tests for configuration loading and network selection logic, which also validate the `explorerd_config.toml` configuration file
- Updated the `explorer_config.toml` file to define initial configurations for localnet, testnet, and mainnet
- Renamed the configuration key `db_path` to `database` for consistency across the project
- Added toml dependency to Cargo.toml
- Removed unused drk dependency from Cargo.toml
- Added rpc to feature list for darkfi dependency
This commit is contained in:
kalm
2025-02-23 22:50:27 -08:00
parent bfe1ec9285
commit b8e93d80af
4 changed files with 377 additions and 28 deletions

View File

@@ -9,10 +9,9 @@ edition = "2021"
[dependencies]
# Darkfi
darkfi = {path = "../../../", features = ["async-daemonize", "validator"]}
darkfi = {path = "../../../", features = ["async-daemonize", "validator", "rpc"]}
darkfi-sdk = {path = "../../../src/sdk"}
darkfi-serial = "0.4.2"
drk = {path = "../../../bin/drk"}
# JSON-RPC
async-trait = "0.1.86"
@@ -38,6 +37,7 @@ sled-overlay = "0.1.6"
log = "0.4.25"
lazy_static = "1.5.0"
tar = "0.4.43"
toml = "0.8.20"
# Testing
tempdir = "0.3.7"