pub struct AppConfigBuilder { /* private fields */ }Expand description
Controls configuration-file selection, application secrets, and test overrides.
Implementations§
Source§impl AppConfigBuilder
impl AppConfigBuilder
pub fn new() -> Self
Sourcepub fn config_file(self, path: impl Into<PathBuf>) -> Self
pub fn config_file(self, path: impl Into<PathBuf>) -> Self
Load exactly this dotenv file. Unlike conventional discovery, a missing explicit file is an error.
Sourcepub fn config_directory(self, path: impl Into<PathBuf>) -> Self
pub fn config_directory(self, path: impl Into<PathBuf>) -> Self
Load Laravel-style TOML files from this config/ directory.
Sourcepub fn without_config_file(self) -> Self
pub fn without_config_file(self) -> Self
Disable dotenv and config/*.toml loading while retaining process
variables and overrides.
Sourcepub fn required_secret(
self,
key: impl Into<String>,
minimum_bytes: usize,
) -> Self
pub fn required_secret( self, key: impl Into<String>, minimum_bytes: usize, ) -> Self
Require a named secret in production and enforce its minimum byte length whenever supplied. The framework does not infer or reuse keys between JWT, encryption, blind-index, or other application purposes.
Sourcepub fn override_value(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn override_value( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add the highest-precedence value, intended for tests and explicit process bootstrap code.
Sourcepub fn load(self) -> Result<AppConfig, ConfigError>
pub fn load(self) -> Result<AppConfig, ConfigError>
Merge and validate all configured sources.
Precedence (low → high): config/*.toml → .env → process environment →
builder overrides. DATABASE_URL from .env/process wins over TOML; otherwise
the URL is built from config/database.toml + DB_CONNECTION / DB_PASSWORD.
§Errors
Returns a source, validation, or production-requirement error.