Installation and dependencies

Version 0.6.0 Updated Nov 12, 2025

Add ortho_config as a dependency in Cargo.toml along with serde:

[dependencies]
ortho_config = "0.6.0"            # replace with the latest version
serde = { version = "1.0", features = ["derive"] }
clap = { version = "4", features = ["derive"] }    # required for CLI support

By default, only TOML configuration files are supported. To enable JSON5 (.json and .json5) and YAML (.yaml and .yml) support, enable the corresponding cargo features:

[dependencies]
ortho_config = { version = "0.6.0", features = ["json5", "yaml"] }
# Enabling these features expands file formats; precedence stays: defaults < file < env < CLI.

Enabling the json5 feature causes both .json and .json5 files to be parsed using the JSON5 format. Without this feature, these files are ignored during discovery and do not cause errors if present. The yaml feature similarly enables .yaml and .yml files; without it, such files are skipped during discovery and do not cause errors if present.

ortho_config re-exports its parsing dependencies, so consumers do not need to declare them directly. Access figment, uncased, xdg (on Unix-like and Redox targets), and the optional parsers (figment_json5, json5, serde_saphyr, toml) via ortho_config:: paths. The serde_json re-export is enabled by default because the crate relies on it internally; disable default features only when explicitly opting back into serde_json.

YAML parsing is handled by the pure-Rust serde-saphyr crate. It adheres to the YAML 1.2 specification, so unquoted scalars such as yes, on, and off remain strings. The provider enables Options::strict_booleans, ensuring only true and false deserialize as booleans, while legacy YAML 1.1 literals are treated as plain strings. Duplicate mapping keys surface as parsing errors instead of silently accepting the last entry, helping catch typos early.