Skip to main content

load_config

Function load_config 

Source
pub fn load_config<S>(path: impl AsRef<Path>) -> ConfigResult<S>
where S: ConfigSchema,
Expand description

Loads a complete confique schema from a root config path.

The loader follows recursive include paths exposed by ConfigSchema, resolves relative include paths from the declaring file, detects include cycles, loads the first .env file found from the root config directory upward, builds a Figment from config files and schema-declared environment variables, and then asks confique to apply defaults and validation. Existing process environment variables take precedence over values loaded from .env.

§Type Parameters

§Arguments

  • path: Root config file path.

§Returns

Returns the merged config schema after loading the root file, recursive includes, .env values, and environment values.