Expand description
ConfigurAnt: schema-first configuration. A project declares its values in configurant.toml;
this library parses the schema, layers the values the caller hands to Loader (default < file <
environment < command line; it reads no file, environment variable or argument by itself),
validates them with named errors, and explains where each value came from. It generates no
code, and a value marked secret is never printed. See README.md and docs/DESIGN.md.
Re-exports§
pub use config::Config;pub use config::DEFAULT_ORDER;pub use config::ExplainLine;pub use config::Explanation;pub use config::FromValue;pub use config::Layer;pub use config::Loader;pub use error::ConfigError;pub use error::Errors;pub use error::Origin;pub use migrate::MigrateError;pub use migrate::Migrated;pub use module::Action;pub use module::ActionKind;pub use module::Choice;pub use module::ChoiceList;pub use module::INTERFACE_VERSION;pub use module::MIN_INTERFACE_VERSION;pub use module::Module;pub use module::ModuleError;pub use module::Modules;pub use module::Needs;pub use module::Plan;pub use project::HostFormat;pub use project::HostSupplied;pub use project::Projection;pub use project::Skipped;pub use project::Var;pub use schema::Bound;pub use schema::MapDef;pub use schema::Migration;pub use schema::Mount;pub use schema::Op;pub use schema::Project;pub use schema::Schema;pub use schema::SchemaError;pub use schema::Step;pub use schema::TableDef;pub use schema::ValueDef;pub use schema::When;pub use value::Row;pub use value::Value;pub use value::ValueType;
Modules§
- config
- Loading: layer defaults, a file, the environment and the command line over a
Schema, validate every input with a named error, and keep each value’s whole history forexplain. - edit
- Editing for front ends (TUI, GUI): the part of a front end that is not drawing.
- error
- Named errors. No variant carries a secret’s value: where a value would be shown for a secret
key, the text is
<redacted>. - exec
- The plan executor, part a (ROADMAP row 28,
docs/PLAN-EXECUTOR.md): steps as data, their validation, the plan hash, and an inertExecPlan::describefor the confirm screen. - json_
schema - Export a ConfigurAnt schema as a JSON Schema (draft 2020-12), so an editor that understands JSON
Schema for TOML (taplo and Even Better TOML, VS Code’s
evenBetterToml.schema.associations) can complete keys, check types and show descriptions in the configuration file (ROADMAP row 13). - keycheck
- The compile-time key check: find the places where Rust code asks the library for a key the schema does
not define. It reads source text and writes nothing (no generated code); run it from a
build.rs, fromconfigurant keys, or in CI. A name it cannot read as a plain string literal is counted, never guessed. - migrate
- Migrating configuration files between config versions, as data: the library returns the new text and a list of changes; only a front end writes a file. Comments and layout survive.
- module
- The module interface: how other tools plug into configuration without the core depending on them (a persistence module, a secrets store, ports, paths, logging).
- modules
- Ready-made
crate::Modules, each behind its own Cargo feature so a project that wants none carries none. Design and rules:docs/MODULES.md. A project registers the ones it uses; a schema value that names an unregistered module is still refused, naming the module. - project
- Projection: render the resolved, NON-secret values of a
Configinto the settings block a host understands (ROADMAP row 33; WebHostAnt is the first customer). - schema
- The schema: what a project’s configuration contains. Parsed from
configurant.toml, strictly (an unknown schema key is an error) and checked against itself. - schema_
edit - Adding one
[[value]]to a schema’s text, as data: the library returns the new text and only a front end writes a file. Comments and layout survive (toml_edit), and the result must parse as a schema, so a rejected addition leaves the caller with the text it had. - value
- Value types and conversion from text (environment, command line) and from TOML (files, defaults).
- view
- A serialisable view-model of an editing
Session, for renderers on any platform. - wizard
- The step engine: a
Wizardwalks a schema’s steps ([[step]], or one per form section) over aDriver, so a terminal, a window and a browser page ask the same questions in the same order.
Constants§
- MAX_
TEXT_ BYTES - The largest schema, fragment or configuration text this library reads. Longer text is refused before it is parsed, so a hostile or mistaken input cannot make the parser spend unbounded time and memory.