Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add(docs): Note default path to config in docs #8143

Merged
merged 4 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ sections in the book for more details.

#### Optional Configs & Features

##### Initializing Configuration File

```console
zebrad generate -o ~/.config/zebrad.toml
```

The above command places the generated `zebrad.toml` config file in the default preferences directory of Linux. For other OSes default locations [see here](https://docs.rs/dirs/latest/dirs/fn.preference_dir.html).

##### Configuring Progress Bars

Configure `tracing.progress_bar` in your `zebrad.toml` to
Expand Down
2 changes: 1 addition & 1 deletion zebra-state/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub struct Config {
/// | Linux | `$XDG_CACHE_HOME/zebra` or `$HOME/.cache/zebra` | `/home/alice/.cache/zebra` |
/// | macOS | `$HOME/Library/Caches/zebra` | `/Users/Alice/Library/Caches/zebra` |
/// | Windows | `{FOLDERID_LocalAppData}\zebra` | `C:\Users\Alice\AppData\Local\zebra` |
/// | Other | `std::env::current_dir()/cache/zebra` | `/cache/zebra` |
/// | Other | `std::env::current_dir()/.cache/zebra` | `/.cache/zebra` |
///
/// # Security
///
Expand Down
10 changes: 10 additions & 0 deletions zebrad/src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ impl Runnable for GenerateCmd {
# 1. The -c flag on the command line, e.g., `zebrad -c myconfig.toml start`;
# 2. The file `zebrad.toml` in the users's preference directory (platform-dependent);
# 3. The default config.
#
# The user's preference directory and the default path to the `zebrad` config are platform dependent,
# based on `dirs::preference_dir`, see https://docs.rs/dirs/latest/dirs/fn.preference_dir.html:
#
# | Platform | Value | Example |
# | -------- | ------------------------------------- | ---------------------------------------------- |
# | Linux | `$XDG_CONFIG_HOME` or `$HOME/.config` | `/home/alice/.config/zebrad.toml` |
# | macOS | `$HOME/Library/Preferences` | `/Users/Alice/Library/Preferences/zebrad.toml` |
# | Windows | `{FOLDERID_RoamingAppData}` | `C:\Users\Alice\AppData\Local\zebrad.toml` |
# | Other | `std::env::current_dir()/.config` | `/.config/zebrad.toml` |

"
.to_owned();
Expand Down
12 changes: 12 additions & 0 deletions zebrad/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ use serde::{Deserialize, Serialize};
/// The `zebrad` config is a TOML-encoded version of this structure. The meaning
/// of each field is described in the documentation, although it may be necessary
/// to click through to the sub-structures for each section.
///
/// The path to the configuration file can also be specified with the `--config` flag when running Zebra.
///
/// The default path to the `zebrad` config is platform dependent, based on
/// [`dirs::preference_dir`](https://docs.rs/dirs/latest/dirs/fn.preference_dir.html):
///
/// | Platform | Value | Example |
/// | -------- | ------------------------------------- | ---------------------------------------------- |
/// | Linux | `$XDG_CONFIG_HOME` or `$HOME/.config` | `/home/alice/.config/zebrad.toml` |
/// | macOS | `$HOME/Library/Preferences` | `/Users/Alice/Library/Preferences/zebrad.toml` |
/// | Windows | `{FOLDERID_RoamingAppData}` | `C:\Users\Alice\AppData\Local\zebrad.toml` |
/// | Other | `std::env::current_dir()/.config` | `/.config/zebrad.toml` |
#[derive(Clone, Default, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields, default)]
pub struct ZebradConfig {
Expand Down
12 changes: 12 additions & 0 deletions zebrad/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@
//! - Additional contexts: wider target deployments for people to use a consensus
//! node in more contexts e.g. mobile, wasm, etc.
//!
//! ## Configuration
//!
//! The command below places the generated `zebrad.toml` config file in the default preferences directory of Linux:
//!
//! ```console
//! zebrad generate -o ~/.config/zebrad.toml
//! ```
//!
//! For other OSes default locations [see here](https://docs.rs/dirs/latest/dirs/fn.preference_dir.html).
//!
//! See [`config::ZebradConfig`] for more information.
//!
//! ## Zebra Feature Flags
//!
//! The following `zebrad` feature flags are available at compile time:
Expand Down
Loading