load

Function load 

Source
pub async fn load(name: &str) -> Result<Config>
Expand description

Load a configuration file by name.

This function searches standard system paths for a configuration file matching the given name with any supported extension. The first file found is loaded and parsed according to its format.

§Arguments

  • name - The base name of the configuration file (without path or extension)

§Returns

A Config instance containing the parsed configuration data.

§Examples

use prefer::load;

#[tokio::main]
async fn main() -> prefer::Result<()> {
    let config = load("myapp").await?;
    let value: String = config.get("some.key")?;
    Ok(())
}