iet-config
core contract official
Defines typed configuration loading and secret handling with no implicit environment access.
CoreFeaturesIntegrationsStacksTooling
Used byiet-appiet-authiet-auth-basiciet-auth-session-jwtiet-auth-session-opaqueiet-config-enviet-db-timescaleiet-http-axum+2 more
iet-configcontractConfiguration contractsDepends oniet-corecontract
How to use it
iet-config loads typed, validated settings from a ConfigSource and returns secrets as a redacted Secret<T>. ConfigLoader calls Configuration::load then validate once at startup; the helpers required, optional, with_default, and secret read individual keys with no implicit environment access.
// crates/core/iet-config/src/lib.rs (inline #[cfg(test)] module)
use ;
;
let settings: Settings = new.load?;
- Defaults apply only to missing keys; a malformed supplied value is a
config.parseerror, never a silent fallback. Secret<T>'sDebugis always[REDACTED], and parse/lookup errors omit the value.
How it works
ConfigLoader pulls typed fields from a ConfigSource via required, optional, or secret, builds the Configuration, and runs validate once before returning the settings.
flowchart LR A["ConfigSource::get key"] --> B["Secret"] B --> C["required"] B --> D["optional"] B --> E["secret"] C --> F["Configuration::load"] F --> G["validate"] G --> H["ConfigLoader::load"] H --> I["typed settings"]
Core contract
This page is the crate reference. For the framework-wide runtime and trait model, read Architecture.
What it implements
- Defines the traits other crates implement:
ConfigSource,Configuration.
What's inside
Modules
src/lib.rs
Public API
(root)
- type
Result - trait
ConfigSource— Sources return secrets as well as public values. Do not log raw source data. Implementations must omit values from errors, including parse/lookup failures.
- struct
Secret— No Display, serialization or deref implementation: exposure must be explicit. This wrapper redacts output; it does not guarantee memory zeroization. pub fn new(value: T) -> Selfpub fn expose(&self) -> &T- trait
Configuration
- struct
ConfigLoader— Concrete source capability for composition/injection. Load once at startup, then inject the validated settings rather than the source into business code. pub fn new(source: S) -> Selfpub fn load<T: Configuration>(&self) -> AppResult<T>pub fn required<T: FromStr>(source: &impl ConfigSource, key: &str) -> AppResult<T>pub fn optional<T: FromStr>(source: &impl ConfigSource, key: &str) -> AppResult<Option<T>>pub fn with_default<T: FromStr>(source: &impl ConfigSource, key: &str, default: T) -> AppResult<T>— Defaults apply only to missing values, never to malformed supplied values.pub fn secret<T: FromStr>(source: &impl ConfigSource, key: &str) -> AppResult<Secret<T>>pub fn failure(code: &str) -> AppError
Impl map
fmt::Debug for Secret<T>
Depends on
Used by
iet-appiet-authiet-auth-basiciet-auth-session-jwtiet-auth-session-opaqueiet-config-enviet-db-timescaleiet-http-axumiet-telemetryiet-telemetry-otel
In this repository
examples/handbook-notesexamples/htmx-starterexamples/skills-only-appexamples/skills-only-app-task-tracker
Source: crates/core/iet-config