Skip to main content

Crate conflaguration

Crate conflaguration 

Source
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§

ConfigBuilder
Fluent builder for layered configuration.
ConfigPrefixView
ConfigView
ValidationMessage
A single validation failure, keyed by dotted field path.

Enums§

Error
All error types produced by conflaguration.

Traits§

ConfigDisplay
Render config fields with their env var keys for debugging/logging.
FromEnvStr
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 default if no key is set.
resolve_with_or_str
Resolve through a custom parse function; if no key is set, parse default_str instead.

Type Aliases§

Result
Crate-level result type.