pub struct Config<TChainsConfig> { /* private fields */ }Expand description
Server configuration.
Fields use serde defaults that fall back to environment variables, then to hardcoded defaults.
Implementations§
Source§impl<TChainsConfig> Config<TChainsConfig>
impl<TChainsConfig> Config<TChainsConfig>
Sourcepub fn host(&self) -> IpAddr
pub fn host(&self) -> IpAddr
Get the host value as an IpAddr.
Returns an error if the host string cannot be parsed as an IP address.
Sourcepub fn schemes(&self) -> &Vec<SchemeConfig>
pub fn schemes(&self) -> &Vec<SchemeConfig>
Get the schemes configuration list.
Each entry specifies a scheme and the chains it applies to.
Sourcepub fn chains(&self) -> &TChainsConfig
pub fn chains(&self) -> &TChainsConfig
Get the chains configuration map.
Keys are CAIP-2 chain identifiers (e.g., “eip155:84532”, “solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp”).
Source§impl<TChainsConfig> Config<TChainsConfig>where
TChainsConfig: Default + for<'de> Deserialize<'de>,
impl<TChainsConfig> Config<TChainsConfig>where
TChainsConfig: Default + for<'de> Deserialize<'de>,
Sourcepub fn load() -> Result<Self, ConfigError>
pub fn load() -> Result<Self, ConfigError>
Load configuration from CLI arguments and JSON file.
The config file path is determined by:
--config <path>CLI argument./config.json(if it exists)
Values not present in the config file will be resolved via environment variables or defaults during deserialization.
Sourcepub fn load_from_path(path: PathBuf) -> Result<Self, ConfigError>
pub fn load_from_path(path: PathBuf) -> Result<Self, ConfigError>
Load configuration from a specific path (or use defaults if None).
Trait Implementations§
Source§impl<'de, TChainsConfig> Deserialize<'de> for Config<TChainsConfig>where
TChainsConfig: Deserialize<'de> + Default,
impl<'de, TChainsConfig> Deserialize<'de> for Config<TChainsConfig>where
TChainsConfig: Deserialize<'de> + Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<TChainsConfig> Freeze for Config<TChainsConfig>where
TChainsConfig: Freeze,
impl<TChainsConfig> RefUnwindSafe for Config<TChainsConfig>where
TChainsConfig: RefUnwindSafe,
impl<TChainsConfig> Send for Config<TChainsConfig>where
TChainsConfig: Send,
impl<TChainsConfig> Sync for Config<TChainsConfig>where
TChainsConfig: Sync,
impl<TChainsConfig> Unpin for Config<TChainsConfig>where
TChainsConfig: Unpin,
impl<TChainsConfig> UnwindSafe for Config<TChainsConfig>where
TChainsConfig: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more