feature: Add the state config to the config file

This commit is contained in:
teor 2020-07-21 15:31:11 +10:00
parent e75697300b
commit 3d721a96a5
3 changed files with 17 additions and 10 deletions

View File

@ -15,9 +15,10 @@ impl Runnable for GenerateCmd {
/// Start the application.
fn run(&self) {
let default_config = ZebradConfig {
tracing: crate::config::TracingSection::populated(),
network: Default::default(),
metrics: Default::default(),
network: Default::default(),
state: Default::default(),
tracing: crate::config::TracingSection::populated(),
};
let mut output = r"# Default configuration for zebrad.
#

View File

@ -47,7 +47,7 @@ pub struct StartCmd {
impl StartCmd {
async fn start(&self) -> Result<(), Report> {
info!(?self, "begin tower-based peer handling test stub");
info!(?self, "starting to connect to the network");
// The service that our node uses to respond to requests by peers
let node = Buffer::new(
@ -57,9 +57,9 @@ impl StartCmd {
}),
1,
);
let config = app_config().network.clone();
let state = zebra_state::on_disk::init(zebra_state::Config::default());
let (peer_set, _address_book) = zebra_network::init(config, node).await;
let config = app_config();
let state = zebra_state::on_disk::init(config.state.clone());
let (peer_set, _address_book) = zebra_network::init(config.network.clone(), node).await;
let verifier = zebra_consensus::chain::init(Mainnet, state.clone());
let mut syncer = sync::Syncer::new(peer_set, state, verifier);

View File

@ -9,6 +9,7 @@ use std::net::SocketAddr;
use serde::{Deserialize, Serialize};
use zebra_network::Config as NetworkSection;
use zebra_state::Config as StateSection;
/// Configuration for `zebrad`.
///
@ -18,12 +19,17 @@ use zebra_network::Config as NetworkSection;
#[derive(Clone, Default, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields, default)]
pub struct ZebradConfig {
/// Tracing configuration
pub tracing: TracingSection,
/// Networking configuration
pub network: NetworkSection,
/// Metrics configuration
pub metrics: MetricsSection,
/// Networking configuration
pub network: NetworkSection,
/// State configuration
pub state: StateSection,
/// Tracing configuration
pub tracing: TracingSection,
}
/// Tracing configuration section.