Skip to main content

Crate dotlyte

Crate dotlyte 

Source
Expand description

§DOTLYTE — The universal configuration library for Rust.

One function call to load .env, YAML, JSON, TOML, environment variables, and defaults with automatic type coercion and layered priority.

§v2 Features

  • Schema validation with type, required, format, enum, min/max, sensitive
  • Variable interpolation (${VAR}, ${VAR:-default}, ${VAR:?error})
  • AES-256-GCM encryption (SOPS-style ENC[aes-256-gcm,...])
  • Sensitive value masking / auto-redaction
  • File watching with polling-based change detection
  • Sub-config scoping, batch require, flat map export
  • System env var blocklist (skip PATH, HOME, etc.)
use dotlyte::load;

let config = load(None).unwrap();
let port: i64 = config.get("port").unwrap_or(3000);
let host: &str = config.get_str("database.host").unwrap_or("localhost");

Re-exports§

pub use crate::encryption::decrypt_value;
pub use crate::encryption::encrypt_value;
pub use crate::encryption::generate_key;
pub use crate::encryption::is_encrypted;
pub use crate::encryption::resolve_encryption_key;
pub use crate::interpolation::interpolate;
pub use crate::masking::build_sensitive_set;
pub use crate::masking::format_redacted;
pub use crate::masking::redact_map;
pub use crate::masking::REDACTED;
pub use crate::validator::apply_schema_defaults;
pub use crate::validator::assert_valid;
pub use crate::validator::get_sensitive_keys;
pub use crate::validator::validate_schema;
pub use crate::validator::DotlyteSchema;
pub use crate::validator::SchemaRule;
pub use crate::watcher::ChangeEvent;
pub use crate::watcher::ConfigWatcher;

Modules§

encryption
AES-256-GCM encryption/decryption for DOTLYTE v2 (SOPS-style).
interpolation
Variable interpolation engine for DOTLYTE v2.
masking
Sensitive value masking for DOTLYTE v2.
validator
Schema validation for DOTLYTE v2.
watcher
Polling-based file watcher for DOTLYTE v2.

Structs§

Config
Immutable configuration object with dot-notation access.
LoadOptions
Options for the load() function.
SchemaViolation
A single schema validation failure.

Enums§

DotlyteError
All possible DOTLYTE errors.

Traits§

FromValue
Trait for converting JSON values to Rust types.
Source
A pluggable configuration source.

Functions§

coerce
Auto-convert a JSON string value to the correct type.
coerce_object
Recursively coerce all string values in a JSON object.
coerce_str
Coerce a string to the best-fit JSON value type.
load
Load configuration from all available sources with layered priority.

Type Aliases§

Result
Result alias for DOTLYTE operations.