introduced a flag to accept toc and exposed it via self-described API
This commit is contained in:
@@ -174,4 +174,10 @@ pub struct AuxiliaryDetails {
|
||||
#[schemars(with = "Option<String>")]
|
||||
#[schemars(length(equal = 2))]
|
||||
pub location: Option<Country>,
|
||||
|
||||
/// Specifies whether this node operator has agreed to the terms and conditions
|
||||
/// 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,
|
||||
}
|
||||
|
||||
@@ -18,6 +18,17 @@ pub(crate) struct Args {
|
||||
#[clap(flatten)]
|
||||
pub(crate) config: ConfigArgs,
|
||||
|
||||
/// Explicitly specify whether you agree with the terms and conditions of a nym node operator
|
||||
/// as defined at <https://nymtech.net/terms-and-conditions/operators/v1.0.0>
|
||||
#[clap(
|
||||
long,
|
||||
env = NYMNODE_ACCEPT_TOC,
|
||||
alias = "accept-toc",
|
||||
alias = "accept-t&c",
|
||||
alias = "accept-operator-terms-and-conditions"
|
||||
)]
|
||||
pub(crate) accept_operator_terms: bool,
|
||||
|
||||
/// Forbid a new node from being initialised if configuration file for the provided specification doesn't already exist
|
||||
#[clap(
|
||||
long,
|
||||
|
||||
@@ -46,6 +46,12 @@ 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;
|
||||
|
||||
if !accepted_toc {
|
||||
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");
|
||||
}
|
||||
|
||||
let config = if !config_path.exists() {
|
||||
debug!("no configuration file found at '{}'", config_path.display());
|
||||
@@ -79,7 +85,7 @@ 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?;
|
||||
let nym_node = NymNode::new(config).await?.with_accepted_toc(accepted_toc);
|
||||
|
||||
// if requested, write bonding info
|
||||
if let Some(bonding_info_path) = bonding_info_path {
|
||||
|
||||
@@ -18,6 +18,8 @@ pub mod vars {
|
||||
|
||||
pub const NYMNODE_MODE_ARG: &str = "NYMNODE_MODE";
|
||||
|
||||
pub const NYMNODE_ACCEPT_TOC: &str = "NYMNODE_ACCEPT_TOC";
|
||||
|
||||
// host:
|
||||
pub const NYMNODE_PUBLIC_IPS_ARG: &str = "NYMNODE_PUBLIC_IPS";
|
||||
pub const NYMNODE_HOSTNAME_ARG: &str = "NYMNODE_HOSTNAME";
|
||||
|
||||
@@ -293,6 +293,8 @@ impl From<WireguardData> for nym_wireguard::WireguardData {
|
||||
|
||||
pub(crate) struct NymNode {
|
||||
config: Config,
|
||||
accepted_toc: bool,
|
||||
|
||||
description: NodeDescription,
|
||||
|
||||
// TODO: currently we're only making measurements in 'mixnode' mode; this should be changed
|
||||
@@ -392,9 +394,15 @@ impl NymNode {
|
||||
exit_gateway: ExitGatewayData::new(&config.exit_gateway)?,
|
||||
wireguard: wireguard_data,
|
||||
config,
|
||||
accepted_toc: false,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn with_accepted_toc(mut self, accepted_toc: bool) -> Self {
|
||||
self.accepted_toc = accepted_toc;
|
||||
self
|
||||
}
|
||||
|
||||
fn exit_network_requester_address(&self) -> Recipient {
|
||||
Recipient::new(
|
||||
self.exit_gateway.nr_ed25519,
|
||||
@@ -530,6 +538,7 @@ impl NymNode {
|
||||
|
||||
let auxiliary_details = api_requests::v1::node::models::AuxiliaryDetails {
|
||||
location: self.config.host.location,
|
||||
accepted_toc: self.accepted_toc,
|
||||
};
|
||||
|
||||
// mixnode info
|
||||
|
||||
Reference in New Issue
Block a user