renamed 'accept-toc' flag and fields into explicit 'accept-operator-terms-and-conditions'

This commit is contained in:
Jędrzej Stuczyński
2024-06-14 17:22:42 +01:00
parent cf5c5f1df4
commit 9ebe8310a1
5 changed files with 19 additions and 13 deletions
@@ -179,5 +179,5 @@ pub struct AuxiliaryDetails {
/// as defined at <https://nymtech.net/terms-and-conditions/operators/v1.0.0>
// make sure to include the default deserialisation as this field hasn't existed when the struct was first created
#[serde(default)]
pub accepted_toc: bool,
pub accepted_operator_terms_and_conditions: bool,
}
+4 -3
View File
@@ -22,12 +22,13 @@ pub(crate) struct Args {
/// as defined at <https://nymtech.net/terms-and-conditions/operators/v1.0.0>
#[clap(
long,
env = NYMNODE_ACCEPT_TOC,
alias = "accept-toc",
env = NYMNODE_ACCEPT_OPERATOR_TERMS,
alias = "accept-t&c",
alias = "accept-operator-terms",
alias = "accept-operator-t&c",
alias = "accept-operator-terms-and-conditions"
)]
pub(crate) accept_operator_terms: bool,
pub(crate) accept_operator_terms_and_conditions: bool,
/// Forbid a new node from being initialised if configuration file for the provided specification doesn't already exist
#[clap(
+5 -3
View File
@@ -46,9 +46,9 @@ pub(crate) async fn execute(mut args: Args) -> Result<(), NymNodeError> {
let bonding_info_path = args.bonding_information_output.clone();
let init_only = args.init_only;
let local = args.local;
let accepted_toc = args.accept_operator_terms;
let accepted_operator_terms_and_conditions = args.accept_operator_terms_and_conditions;
if !accepted_toc {
if !accepted_operator_terms_and_conditions {
warn!("you don't seem to have accepted the terms and conditions of a Nym node operator");
warn!("please familiarise yourself with <https://nymtech.net/terms-and-conditions/operators/v1.0.0> and run the binary with '--accept-toc' flag if you agree with them");
}
@@ -85,7 +85,9 @@ pub(crate) async fn execute(mut args: Args) -> Result<(), NymNodeError> {
}
check_public_ips(&config.host.public_ips, local)?;
let nym_node = NymNode::new(config).await?.with_accepted_toc(accepted_toc);
let nym_node = NymNode::new(config)
.await?
.with_accepted_operator_terms_and_conditions(accepted_operator_terms_and_conditions);
// if requested, write bonding info
if let Some(bonding_info_path) = bonding_info_path {
+1 -1
View File
@@ -18,7 +18,7 @@ pub mod vars {
pub const NYMNODE_MODE_ARG: &str = "NYMNODE_MODE";
pub const NYMNODE_ACCEPT_TOC: &str = "NYMNODE_ACCEPT_TOC";
pub const NYMNODE_ACCEPT_OPERATOR_TERMS: &str = "NYMNODE_ACCEPT_OPERATOR_TERMS";
// host:
pub const NYMNODE_PUBLIC_IPS_ARG: &str = "NYMNODE_PUBLIC_IPS";
+8 -5
View File
@@ -293,7 +293,7 @@ impl From<WireguardData> for nym_wireguard::WireguardData {
pub(crate) struct NymNode {
config: Config,
accepted_toc: bool,
accepted_operator_terms_and_conditions: bool,
description: NodeDescription,
@@ -394,12 +394,15 @@ impl NymNode {
exit_gateway: ExitGatewayData::new(&config.exit_gateway)?,
wireguard: wireguard_data,
config,
accepted_toc: false,
accepted_operator_terms_and_conditions: false,
})
}
pub(crate) fn with_accepted_toc(mut self, accepted_toc: bool) -> Self {
self.accepted_toc = accepted_toc;
pub(crate) fn with_accepted_operator_terms_and_conditions(
mut self,
accepted_operator_terms_and_conditions: bool,
) -> Self {
self.accepted_operator_terms_and_conditions = accepted_operator_terms_and_conditions;
self
}
@@ -538,7 +541,7 @@ impl NymNode {
let auxiliary_details = api_requests::v1::node::models::AuxiliaryDetails {
location: self.config.host.location,
accepted_toc: self.accepted_toc,
accepted_operator_terms_and_conditions: self.accepted_operator_terms_and_conditions,
};
// mixnode info