Expand description
§Common logging and configuration utilities
§The global Tari configuration file
A single configuration file (usually ~/.tari/config.toml is used to manage settings for all Tari applications
and nodes running on a single system, whether it’s a base node, validator node, or wallet.
Setting of configuration parameters is applied using the following order of precedence:
- Command-line argument
- Environment variable
config.tomlfile value (see details: configuration)- Configuration default
The utilities exposed in this crate are opinionated, but flexible. In general, all data is stored in a .tari
folder under your home folder.
§Custom application configuration
Tari configuration file allows adding custom application specific sections. Tari is using config crate
to load configurations and gives access to config::Config struct so that apps might be flexible.
Though as tari apps follow certain configurability assumptions, tari_common provides helper traits
which automate those with minimal code.
§CLI helpers
Bootstrapping tari configuration files might be customized via CLI or env settings. To help with building tari-enabled CLI from scratch as easy as possible this crate exposes [ConfigBootstrap] struct which implements structopt::StructOpt trait and can be easily reused in any CLI.
Re-exports§
pub use configuration::bootstrap::install_configuration;pub use configuration::error::ConfigError;pub use configuration::loader::ConfigLoader;pub use configuration::loader::ConfigPath;pub use configuration::loader::ConfigurationError;pub use configuration::loader::DefaultConfigLoader;pub use configuration::loader::SubConfigPath;pub use configuration::name_server::DnsNameServer;pub use configuration::utils::load_configuration;
Modules§
- configuration
- Configuration of tari applications
- dir_
utils - exit_
codes - network_
check
Macros§
- log_
if_ error - Log an error if an
Erris returned from the$expr. If the given expression isOk(v),Some(v)is returned, otherwiseNoneis returned (same asResult::ok). Useful in cases where the error should be logged and ignored. instead of writingif let Err(err) = my_error_call() { error!(...) }, you can writelog_if_error!(my_error_call()) - log_
if_ error_ fmt - See log_if_error!.
Constants§
- DEFAULT_
BASE_ NODE_ LOG_ CONFIG - DEFAULT_
COLLECTIBLES_ LOG_ CONFIG - DEFAULT_
CONFIG - DEFAULT_
MERGE_ MINING_ PROXY_ LOG_ CONFIG - DEFAULT_
MINER_ LOG_ CONFIG - DEFAULT_
STRATUM_ TRANSCODER_ LOG_ CONFIG - DEFAULT_
WALLET_ LOG_ CONFIG - MAX_
GRPC_ MESSAGE_ SIZE - Maximum gRPC message size for clients and servers: 2MiB (coinbases) + 4MiB (transaction payload) + 2MiB (spare capacity) = 8 MiB
Functions§
- initialize_
logging - Set up application-level logging using the Log4rs configuration file specified in