mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-06-27 17:39:27 +00:00
BREAKING CHANGE: LEZ crates have been moved from top-level directories into
a dedicated `lez/` subdirectory. The following crates were relocated:
common → lez/common
indexer → lez/indexer
explorer_service→ lez/explorer_service
keycard_wallet → lez/keycard_wallet
mempool → lez/mempool
sequencer → lez/sequencer
storage → lez/storage
testnet_initial_state → lez/testnet_initial_state
wallet → lez/wallet
wallet-ffi → lez/wallet-ffi
Any external tooling, scripts, or paths referencing these crates at their
previous top-level locations must be updated.
47 lines
1.2 KiB
Rust
47 lines
1.2 KiB
Rust
use std::{
|
|
fs::File,
|
|
io::BufReader,
|
|
path::{Path, PathBuf},
|
|
time::Duration,
|
|
};
|
|
|
|
use anyhow::{Context as _, Result};
|
|
use common::config::BasicAuth;
|
|
use humantime_serde;
|
|
pub use logos_blockchain_core::mantle::ops::channel::ChannelId;
|
|
use serde::{Deserialize, Serialize};
|
|
use url::Url;
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ClientConfig {
|
|
pub addr: Url,
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
pub auth: Option<BasicAuth>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct IndexerConfig {
|
|
/// Home dir of indexer storage.
|
|
pub home: PathBuf,
|
|
#[serde(with = "humantime_serde")]
|
|
pub consensus_info_polling_interval: Duration,
|
|
pub bedrock_config: ClientConfig,
|
|
pub channel_id: ChannelId,
|
|
}
|
|
|
|
impl IndexerConfig {
|
|
pub fn from_path(config_path: &Path) -> Result<Self> {
|
|
let file = File::open(config_path).with_context(|| {
|
|
format!("Failed to open indexer config at {}", config_path.display())
|
|
})?;
|
|
let reader = BufReader::new(file);
|
|
|
|
serde_json::from_reader(reader).with_context(|| {
|
|
format!(
|
|
"Failed to parse indexer config at {}",
|
|
config_path.display()
|
|
)
|
|
})
|
|
}
|
|
}
|