Files
darkfi/bin/explorer/explorerd/explorerd_config.toml
kalm b8e93d80af 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
2025-02-24 06:06:10 -08:00

66 lines
1.6 KiB
TOML

## explorerd configuration file
##
## Please make sure you go through all the settings so you can configure
## your daemon properly.
##
## The default values are left commented. They can be overridden either by
## uncommenting, or by using the command-line.
# Blockchain network to use
network = "testnet"
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Localnet Configuration
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[network_config."localnet"]
# Path to daemon database
database = "~/.local/share/darkfi/explorerd/localnet"
# darkfid JSON-RPC endpoint
endpoint = "tcp://127.0.0.1:8240"
## Localnet JSON-RPC settings
[network_config."localnet".rpc]
# JSON-RPC listen URL
rpc_listen = "tcp://127.0.0.1:14567"
# Disabled RPC methods
#rpc_disabled_methods = []
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Testnet Configuration
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[network_config."testnet"]
# Path to daemon database
database = "~/.local/share/darkfi/explorerd/testnet"
# darkfid JSON-RPC endpoint
endpoint = "tcp://127.0.0.1:8340"
## Localnet JSON-RPC settings
[network_config."testnet".rpc]
rpc_listen = "tcp://127.0.0.1:14667"
# Disabled RPC methods
#rpc_disabled_methods = []
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Mainnet Configuration
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[network_config."mainnet"]
# Path to daemon database
database = "~/.local/share/darkfi/explorerd/mainnet"
# darkfid JSON-RPC endpoint
endpoint = "tcp://127.0.0.1:8440"
## Localnet JSON-RPC settings
[network_config."mainnet".rpc]
rpc_listen = "tcp://127.0.0.1:14767"
# Disabled RPC methods
#rpc_disabled_methods = []