miden_node_utils/
config.rs

1use std::path::Path;
2
3use figment::{
4    Figment,
5    providers::{Format, Toml},
6};
7use serde::Deserialize;
8
9pub const DEFAULT_NODE_RPC_PORT: u16 = 57291;
10pub const DEFAULT_BLOCK_PRODUCER_PORT: u16 = 48046;
11pub const DEFAULT_STORE_PORT: u16 = 28943;
12pub const DEFAULT_FAUCET_SERVER_PORT: u16 = 8080;
13
14/// Loads the user configuration.
15///
16/// This function will look for the configuration file at the provided path. If the path is
17/// relative, searches in parent directories all the way to the root as well.
18///
19/// The above configuration options are indented to support easy of packaging and deployment.
20pub fn load_config<T: for<'a> Deserialize<'a>>(
21    config_file: impl AsRef<Path>,
22) -> figment::Result<T> {
23    Figment::from(Toml::file(config_file.as_ref())).extract()
24}