[][src]Module tari_common::configuration::bootstrap

Building tari-based applications CLI

To help with building tari-enabled CLI from scratch as easy as possible this crate exposes ConfigBootstrap struct. ConfigBootstrap implements structopt::StructOpt trait, all CLI options required for initializing configs can be embedded in any StructOpt derived struct.

After loading ConfigBootstrap parameters it is necessary to call ConfigBootstrap::init_dirs() which would create necessary configuration files based on input parameters. This usually followed by:

Example - CLI which is loading and deserializing the global config file

This example is not tested
use tari_common::ConfigBootstrap;

// Parse and validate command-line arguments
let mut bootstrap = ConfigBootstrap::from_args();
// Check and initialize configuration files
bootstrap.init_dirs()?;
// Load and apply configuration file
let config = bootstrap.load_configuration()?;
// Initialise the logger
bootstrap.initialize_logging()?;
assert_eq!(config.network, Network::MainNet);
assert_eq!(config.blocking_threads, 4);
> main -h
main 0.0.0
The reference Tari cryptocurrency base node implementation

USAGE:
    main [FLAGS] [OPTIONS]

FLAGS:
    -h, --help       Prints help information
        --create-id  Create and save new node identity if one doesn't exist
        --init       Create a default configuration file if it doesn't exist
    -V, --version    Prints version information

OPTIONS:
        --base-path <base-path>      A path to a directory to store your files
        --config <config>            A path to the configuration file to use (config.toml)
        --log-config <log-config>    The path to the log configuration file. It is set using the following precedence
                                     set: [env: TARI_LOG_CONFIGURATION=]

Structs

ConfigBootstrap

Enums

ApplicationType

Functions

install_configuration