Merge branch 'develop' into feature/add-http-interface
This commit is contained in:
@@ -12,6 +12,12 @@ pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
|
||||
.takes_value(true)
|
||||
.required(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("location")
|
||||
.long("location")
|
||||
.help("Optional geographical location of this node")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("directory")
|
||||
.long("directory")
|
||||
|
||||
@@ -9,5 +9,9 @@ pub(crate) fn override_config(mut config: Config, matches: &ArgMatches) -> Confi
|
||||
config = config.with_custom_directory(directory);
|
||||
}
|
||||
|
||||
if let Some(location) = matches.value_of("location") {
|
||||
config = config.with_location(location);
|
||||
}
|
||||
|
||||
config
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
|
||||
.required(true),
|
||||
)
|
||||
// the rest of arguments are optional, they are used to override settings in config file
|
||||
.arg(
|
||||
Arg::with_name("location")
|
||||
.long("location")
|
||||
.help("Optional geographical location of this node")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("config")
|
||||
.long("config")
|
||||
|
||||
@@ -98,11 +98,21 @@ impl Config {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_location<S: Into<String>>(mut self, location: S) -> Self {
|
||||
self.validator.location = location.into();
|
||||
self
|
||||
}
|
||||
|
||||
// getters
|
||||
pub fn get_config_file_save_location(&self) -> PathBuf {
|
||||
self.config_directory().join(Self::config_file_name())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_location(&self) -> String {
|
||||
self.validator.location.clone()
|
||||
}
|
||||
|
||||
pub fn get_mix_mining_directory_server(&self) -> String {
|
||||
self.mix_mining.directory_server.clone()
|
||||
}
|
||||
@@ -137,17 +147,28 @@ pub struct Validator {
|
||||
/// ID specifies the human readable ID of this particular validator.
|
||||
id: String,
|
||||
|
||||
/// Completely optional value specifying geographical location of this particular node.
|
||||
/// Currently it's used entirely for debug purposes, as there are no mechanisms implemented
|
||||
/// to verify correctness of the information provided. However, feel free to fill in
|
||||
/// this field with as much accuracy as you wish to share.
|
||||
location: String,
|
||||
|
||||
/// nym_home_directory specifies absolute path to the home nym MixNodes directory.
|
||||
/// It is expected to use default value and hence .toml file should not redefine this field.
|
||||
nym_root_directory: PathBuf,
|
||||
}
|
||||
|
||||
impl Validator {}
|
||||
impl Validator {
|
||||
fn default_location() -> String {
|
||||
"unknown".into()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Validator {
|
||||
fn default() -> Self {
|
||||
Validator {
|
||||
id: "".to_string(),
|
||||
location: Self::default_location(),
|
||||
nym_root_directory: Config::default_root_directory(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@ pub(crate) fn config_template() -> &'static str {
|
||||
# Human readable ID of this particular validator.
|
||||
id = "{{ validator.id }}"
|
||||
|
||||
# Completely optional value specifying geographical location of this particular node.
|
||||
# Currently it's used entirely for debug purposes, as there are no mechanisms implemented
|
||||
# to verify correctness of the information provided. However, feel free to fill in
|
||||
# this field with as much accuracy as you wish to share.
|
||||
location = "{{ validator.location }}"
|
||||
|
||||
##### advanced configuration options #####
|
||||
|
||||
# nym_home_directory specifies absolute path to the home nym validators directory.
|
||||
|
||||
Reference in New Issue
Block a user