8 releases (4 breaking)
| 0.5.1 | Feb 12, 2026 |
|---|---|
| 0.5.0 | Feb 12, 2026 |
| 0.4.0 | Jan 19, 2026 |
| 0.3.0 | Jan 18, 2026 |
| 0.1.3 | Jan 9, 2026 |
#614 in Configuration
Used in holoconf-cli
395KB
9K
SLoC
holoconf-core
Core configuration library with hierarchical merging, interpolation, and schema validation.
Features
- Interpolation - Reference environment variables (
${env:VAR}), other config values (${path.to.value}), and files (${file:config.yaml}) - Hierarchical merging - Combine multiple config files with predictable override behavior
- Schema validation - Validate configuration against JSON Schema
- Type coercion - Automatic conversion between compatible types based on schema definitions
- Lazy resolution - Values are resolved on access, not at parse time
Installation
[dependencies]
holoconf-core = "0.1"
Quick Start
use holoconf_core::Config;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Load from YAML string
let config = Config::from_str(r#"
database:
host: ${env:DB_HOST,localhost}
port: 5432
"#)?;
// Access values
let host: String = config.get("database.host")?;
let port: i64 = config.get("database.port")?;
println!("Connecting to {}:{}", host, port);
Ok(())
}
Interpolation Syntax
| Syntax | Description | Example |
|---|---|---|
${env:VAR} |
Environment variable | ${env:HOME} |
${env:VAR,default} |
Env var with default | ${env:PORT,8080} |
${path.to.value} |
Self-reference | ${database.host} |
${.sibling} |
Relative reference | ${.port} |
${file:path} |
Include file | ${file:./secrets.yaml} |
\${literal} |
Escape (literal ${) |
\${not_interpolated} |
Documentation
- User Guide - Full documentation
- API Reference - Rust API docs
- GitHub - Source code and issues
Related Crates
holoconf-cli- Command-line interface
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Dependencies
~13–32MB
~491K SLoC