|
| 1 | +use init4_bin_base::utils::from_env::FromEnv; |
| 2 | +use std::borrow::Cow; |
| 3 | + |
| 4 | +/// Configuration for the block extractor. |
| 5 | +#[derive(Debug, Clone, serde::Deserialize, FromEnv)] |
| 6 | +#[serde(rename_all = "camelCase")] |
| 7 | +pub struct BlockExtractorConfig { |
| 8 | + /// URL of the blob explorer. |
| 9 | + #[from_env(var = "BLOB_EXPLORER_URL", desc = "URL of the blob explorer", infallible)] |
| 10 | + blob_explorer_url: Cow<'static, str>, |
| 11 | + |
| 12 | + /// Consensus layer RPC URL |
| 13 | + #[from_env(var = "SIGNET_CL_URL", desc = "Consensus layer URL", infallible, optional)] |
| 14 | + cl_url: Option<Cow<'static, str>>, |
| 15 | + |
| 16 | + /// The Pylon node URL |
| 17 | + #[from_env(var = "SIGNET_PYLON_URL", desc = "Pylon node URL", infallible, optional)] |
| 18 | + pylon_url: Option<Cow<'static, str>>, |
| 19 | +} |
| 20 | + |
| 21 | +impl BlockExtractorConfig { |
| 22 | + /// Create a new `BlockExtractorConfig` with the provided CL URL, Pylon URL, |
| 23 | + pub fn cl_url(&self) -> Option<&str> { |
| 24 | + self.cl_url.as_deref() |
| 25 | + } |
| 26 | + |
| 27 | + /// Get the Pylon URL. |
| 28 | + pub fn pylon_url(&self) -> Option<&str> { |
| 29 | + self.pylon_url.as_deref() |
| 30 | + } |
| 31 | + |
| 32 | + /// Get the blob explorer URL. |
| 33 | + pub fn blob_explorer_url(&self) -> &str { |
| 34 | + &self.blob_explorer_url |
| 35 | + } |
| 36 | +} |
0 commit comments