holoconf-core

Crates.ioholoconf-core
lib.rsholoconf-core
version0.4.0
created_at2026-01-09 06:28:54.347335+00
updated_at2026-01-19 23:44:33.883159+00
descriptionCore configuration library with resolver support
homepage
repositoryhttps://github.com/rfestag/holoconf
max_upload_size
id2031684
size394,639
Ryan Festag (rfestag)

documentation

https://rfestag.github.io/holoconf/

README

holoconf-core

crates.io docs.rs License: MIT

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

Related Crates

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Commit count: 65

cargo fmt