pub fn load_config() -> Result<Config, ConfigError>Expand description
Loads configuration from the default location with defaults for missing values.
This is a convenience function that:
- Creates a
ConfigLoaderwith the default base directory - Loads the configuration (returning defaults if file doesn’t exist)
§Errors
Returns ConfigError::NoHomeDirectory if the home directory cannot be determined.
Returns ConfigError::ParseFailed if the configuration file contains invalid TOML.
Returns ConfigError::Io if there’s an I/O error reading the file.
§Examples
use txgate_core::config_loader::load_config;
let config = load_config().expect("failed to load config");
println!("Socket path: {}", config.server.socket_path);