pub fn load<T: DeserializeOwned>(config_dir: &str) -> Result<T>Expand description
Loads and deserializes a YAML config file for the current environment.
The file is resolved as {config_dir}/{APP_ENV}.yaml. After reading, all
${VAR} and ${VAR:default} placeholders are replaced with values from
the process environment before deserialization.
§Errors
Returns an error when:
- The config file cannot be read.
- A required
${VAR}placeholder references an unset environment variable. - The YAML cannot be deserialized into
T.
§Example
use modo::config::load;
use modo::Config;
let config: Config = load("config/").unwrap();