pub struct Config {
pub app: AppConfig,
pub database: DatabaseConfig,
pub network: NetworkConfig,
pub providers: ProvidersConfig,
pub features: FeaturesConfig,
}Expand description
Main configuration structure that aggregates all subsystems
Fields§
§app: AppConfigApplication-level configuration
database: DatabaseConfigDatabase connections
network: NetworkConfigNetwork and blockchain configuration
providers: ProvidersConfigExternal API providers
features: FeaturesConfigFeature flags
Implementations§
Source§impl Config
impl Config
Sourcepub fn try_from_env() -> Result<Arc<Config>, ConfigError>
pub fn try_from_env() -> Result<Arc<Config>, ConfigError>
Try to load configuration from environment variables
This will:
- Load .env file if present
- Parse environment variables
- Apply convention-based patterns (RPC_URL_{CHAIN_ID})
- Load chains.toml if specified
- Validate all configuration
Returns a Result instead of exiting on failure, making it suitable for library usage and programmatic configuration building.
Sourcepub fn from_env() -> Arc<Config>
pub fn from_env() -> Arc<Config>
Load configuration from environment variables (fail-fast)
This will:
- Load .env file if present
- Parse environment variables
- Apply convention-based patterns (RPC_URL_{CHAIN_ID})
- Load chains.toml if specified
- Validate all configuration
This is a wrapper around try_from_env() that exits the process
on failure, suitable for application main binaries.
Sourcepub fn validate_config(&self) -> Result<(), ConfigError>
pub fn validate_config(&self) -> Result<(), ConfigError>
Validate the entire configuration
Sourcepub fn builder() -> ConfigBuilder
pub fn builder() -> ConfigBuilder
Create a builder for constructing configuration programmatically
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Config, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Config, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Config
impl Serialize for Config
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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