tor-config: Tools for configuration management in Arti
It provides types for handling configuration values, and general machinery for configuration management.
The configuration for the
arti command line program,
and other programs which embed Arti reusing the configuration machinery,
works as follows:
tor_config::ConfigurationSourcesto enumerate the various places where configuration information needs to come from, and configure how they are to be read.
ConfigurationSources::loadactually reads all of these sources, parses them (eg, as TOML files), and returns a
config::Config. This is a tree-structured dynamically typed data structure, mirroring the input configuration structure, largely unvalidated, and containing everything in the input config sources.
We call one of the
tor_config::resolvefamily. This maps the input configuration data to concrete
ConfigBuilders for the configuration consumers within the program. (For
ArtiBuilder). This mapping is done using the
Deserializeimplementations on the
resolvethen calls the
build()method on each of these parts of the configuration which applies defaults and validates the resulting configuration.
It is important to call
resolveonce for all the configuration consumers, so that it sees a unified view of which config settings in the input were unrecognized, and therefore may need to be reported to the user. See the example in the
The resulting configuration objects (eg,
ArtiConfig) are provided to the code that must use them (eg, to make a
tor_config::load module-level documentation.
for an example.
The design of this crate, and of the configuration system for Arti, is likely to change significantly before the release of Arti 1.0.0. For more information see ticket #285.
pub use cmdline::CmdLine;
pub use config as config_crate;
pub use educe;
pub use load::resolve;
pub use load::resolve_ignore_unrecognized;
pub use load::resolve_return_unrecognized;
pub use serde;
pub use sources::ConfigurationSources;
Implement a configuration source based on command-line arguments.
Lists in builders
Processing a config::Config into a validated configuration
ConfigurationSources: Helper for handling configuration files
Define accessor methods for a configuration item which is a list
Defines standard impls for a struct with a
Helper for assisting with macro “argument” defaulting
A path in a configuration file: tilde expansion is performed, along with expansion of certain variables.
A mutable configuration object.
An error that has occurred while expanding a path.
An error related to an option passed to Arti via a configuration builder.
Rules for reconfiguring a running Arti instance.
An error caused when attempting to reconfigure an existing Arti client, or one of its modules.
Option<Option<T>> (in a builder) into an