Expand description
Typed configuration from environment variables, files, and fluent builders.
ⓘ
use conflaguration::{Settings, Validate, init};
#[derive(Settings, Validate)]
#[settings(prefix = "APP")]
struct Config {
#[setting(default = 8080)]
port: u16,
#[setting(default = "localhost")]
host: String,
}
let config: Config = init().unwrap();Structs§
- Config
Builder - Fluent builder for layered configuration.
- Config
Prefix View - Config
View - Validation
Message - A single validation failure, keyed by dotted field path.
Enums§
- Error
- All error types produced by conflaguration.
Traits§
- Config
Display - Render config fields with their env var keys for debugging/logging.
- From
EnvStr - Settings
- Construct a typed config struct from environment variables.
- Validate
- Validate a config struct after construction.
Functions§
- builder
- Start a fluent builder for layered config: defaults, env, files, overrides.
- init
- Construct from env and validate in one step.
- load
- load_
override - load_
override_ path - load_
path - resolve
- resolve_
or - resolve_
or_ else - resolve_
or_ parse - resolve_
with - Resolve an env var through a custom parse function. Errors if no key is set.
- resolve_
with_ or - Resolve through a custom parse function, falling back to
defaultif no key is set. - resolve_
with_ or_ str - Resolve through a custom parse function; if no key is set, parse
default_strinstead.
Type Aliases§
- Result
- Crate-level result type.