Skip to content
This repository has been archived by the owner on Feb 15, 2021. It is now read-only.

Commit

Permalink
Add ZkSyncConfig structure
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Dec 18, 2020
1 parent 912c17d commit fbf027f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions core/lib/config/src/configs/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// External deps
use serde::Deserialize;

// Public re-exports
pub use self::{
api::ApiConfig, chain::ChainConfig, contracts::ContractsConfig, db::DBConfig,
Expand All @@ -16,6 +19,35 @@ pub mod misc;
pub mod prover;
pub mod ticker;

#[derive(Debug, Deserialize, Clone, PartialEq)]
pub struct ZkSyncConfig {
pub api: ApiConfig,
pub chain: ChainConfig,
pub contracts: ContractsConfig,
pub db: DBConfig,
pub eth_client: ETHClientConfig,
pub eth_sender: ETHSenderConfig,
pub eth_watch: ETHWatchConfig,
pub prover: ProverConfig,
pub ticker: TickerConfig,
}

impl ZkSyncConfig {
pub fn from_env() -> Self {
Self {
api: ApiConfig::from_env(),
chain: ChainConfig::from_env(),
contracts: ContractsConfig::from_env(),
db: DBConfig::from_env(),
eth_client: ETHClientConfig::from_env(),
eth_sender: ETHSenderConfig::from_env(),
eth_watch: ETHWatchConfig::from_env(),
prover: ProverConfig::from_env(),
ticker: TickerConfig::from_env(),
}
}
}

#[cfg(test)]
pub(crate) mod test_utils;

Expand Down

0 comments on commit fbf027f

Please sign in to comment.