Skip to main content

load_config

Function load_config 

Source
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:

  1. Creates a ConfigLoader with the default base directory
  2. 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);