12 unstable releases (3 breaking)
|0.8.1||Jan 29, 2021|
|0.2.7||Oct 12, 2020|
|0.2.5||Sep 1, 2020|
|0.2.0||Jul 15, 2020|
|0.0.5||Sep 2, 2019|
#13 in #tari
165 downloads per month
Used in 9 crates (5 directly)
This crate provides commonly-used features that are shared across multiple Tari domain layers. Since they may refer to
domain-level concepts, it's inappropriate to place them inside the
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
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.
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.
Example - CLI which is loading and deserializing the global config file
let mut args = ConfigBootstrap::from_args(); args.init_dirs(ApplicationType::BaseNode); let config = args.load_configuration().unwrap(); let global = GlobalConfig::convert_from(config).unwrap(); assert_eq!(global.network, Network::Stibbons); assert!(global.max_threads.is_none());