pub struct ConfigLoader { /* private fields */ }Expand description
Loads a BaukitConfig using the Baukit precedence and naming conventions.
Implementations§
Source§impl ConfigLoader
impl ConfigLoader
Sourcepub fn new(app_name: &str, environment: Environment) -> Result<Self, LoadError>
pub fn new(app_name: &str, environment: Environment) -> Result<Self, LoadError>
Creates a loader for an application and deployment environment.
ASCII letters are uppercased and - becomes _, so my-app uses the
MY_APP__ prefix. Other characters are rejected.
Sourcepub fn local_file(self, path: impl Into<PathBuf>) -> Self
pub fn local_file(self, path: impl Into<PathBuf>) -> Self
Replaces the optional local configuration-file path.
Sourcepub fn without_local_file(self) -> Self
pub fn without_local_file(self) -> Self
Disables the local configuration-file layer.
Sourcepub fn dotenv_file(self, path: impl Into<PathBuf>) -> Self
pub fn dotenv_file(self, path: impl Into<PathBuf>) -> Self
Replaces the local dotenv-file path.
This path is ignored unless the loader environment is local.
Sourcepub fn without_dotenv(self) -> Self
pub fn without_dotenv(self) -> Self
Disables dotenv loading, including in the local environment.
Sourcepub fn environment_prefix(&self) -> &str
pub fn environment_prefix(&self) -> &str
Returns the normalized environment-variable prefix without its separator.
Sourcepub fn environment_collection(self, path: impl Into<String>) -> Self
pub fn environment_collection(self, path: impl Into<String>) -> Self
Registers a product collection field for JSON-array environment input.
Use its configuration path after prefix/separator normalization, such as
allowed_tags or notifications.channels. The standard
http.cors_allowed_origins field is registered automatically. Other
environment values remain literal strings, even when they contain valid
JSON array syntax.
Sourcepub fn load<T>(&self) -> Result<BaukitConfig<T>, LoadError>
pub fn load<T>(&self) -> Result<BaukitConfig<T>, LoadError>
Loads, deserializes, and validates a standard configuration plus product fields.