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() -> ConfigResult<Arc<Self>>
pub fn try_from_env() -> ConfigResult<Arc<Self>>
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<Self>
pub fn from_env() -> Arc<Self>
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) -> ConfigResult<()>
pub fn validate_config(&self) -> ConfigResult<()>
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<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 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