#[cfg(feature = "faucet")]
use super::faucet::FaucetConfig;
#[cfg(feature = "noble")]
use super::noble::NobleConfig;
use super::{indexer::IndexerConfig, node::NodeConfig};
use anyhow::Error;
use serde::Deserialize;
use std::path::Path;
use tokio::fs;
#[derive(Debug, Deserialize)]
pub struct ClientConfig {
pub indexer: IndexerConfig,
pub node: NodeConfig,
#[cfg(feature = "faucet")]
pub faucet: Option<FaucetConfig>,
#[cfg(feature = "noble")]
pub noble: Option<NobleConfig>,
}
impl ClientConfig {
pub async fn from_file(path: impl AsRef<Path>) -> Result<Self, Error> {
let toml_str = fs::read_to_string(path).await?;
let config = toml::from_str(&toml_str)?;
Ok(config)
}
}