diff --git a/clients/native/src/commands/build_info.rs b/clients/native/src/commands/build_info.rs new file mode 100644 index 0000000000..e3385bb933 --- /dev/null +++ b/clients/native/src/commands/build_info.rs @@ -0,0 +1,16 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use clap::Args; +use nym_bin_common::bin_info_owned; +use nym_bin_common::output_format::OutputFormat; + +#[derive(Args)] +pub(crate) struct BuildInfo { + #[clap(short, long, default_value_t = OutputFormat::default())] + output: OutputFormat, +} + +pub(crate) fn execute(args: BuildInfo) { + println!("{}", args.output.format(&bin_info_owned!())) +} diff --git a/clients/native/src/commands/mod.rs b/clients/native/src/commands/mod.rs index 08c4f9592d..6badc58748 100644 --- a/clients/native/src/commands/mod.rs +++ b/clients/native/src/commands/mod.rs @@ -10,7 +10,7 @@ use clap::CommandFactory; use clap::{Parser, Subcommand}; use lazy_static::lazy_static; use log::{error, info}; -use nym_bin_common::build_information::BinaryBuildInformation; +use nym_bin_common::bin_info; use nym_bin_common::completions::{fig_generate, ArgShell}; use nym_client_core::client::base_client::storage::gateway_details::{ OnDiskGatewayDetails, PersistedGatewayDetails, @@ -22,12 +22,12 @@ use nym_config::OptionalSet; use std::error::Error; use std::net::IpAddr; +pub(crate) mod build_info; pub(crate) mod init; pub(crate) mod run; lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = - BinaryBuildInformation::new(env!("CARGO_PKG_VERSION")).pretty_print(); + pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); } // Helper for passing LONG_VERSION to clap @@ -42,6 +42,10 @@ pub(crate) struct Cli { #[clap(short, long)] pub(crate) config_env_file: Option, + /// Flag used for disabling the printed banner in tty. + #[clap(long)] + pub(crate) no_banner: bool, + #[clap(subcommand)] command: Commands, } @@ -54,6 +58,9 @@ pub(crate) enum Commands { /// Run the Nym client with provided configuration client optionally overriding set parameters Run(run::Run), + /// Show build information of this binary + BuildInfo(build_info::BuildInfo), + /// Generate shell completions Completions(ArgShell), @@ -73,12 +80,13 @@ pub(crate) struct OverrideConfig { enabled_credentials_mode: Option, } -pub(crate) async fn execute(args: &Cli) -> Result<(), Box> { +pub(crate) async fn execute(args: Cli) -> Result<(), Box> { let bin_name = "nym-native-client"; - match &args.command { - Commands::Init(m) => init::execute(m).await?, - Commands::Run(m) => run::execute(m).await?, + match args.command { + Commands::Init(m) => init::execute(&m).await?, + Commands::Run(m) => run::execute(&m).await?, + Commands::BuildInfo(m) => build_info::execute(m), Commands::Completions(s) => s.generate(&mut Cli::command(), bin_name), Commands::GenerateFigSpec => fig_generate(&mut Cli::command(), bin_name), } diff --git a/clients/native/src/main.rs b/clients/native/src/main.rs index cc862b2a88..cf3203b1e3 100644 --- a/clients/native/src/main.rs +++ b/clients/native/src/main.rs @@ -14,10 +14,13 @@ pub mod websocket; #[tokio::main] async fn main() -> Result<(), Box> { - setup_logging(); - maybe_print_banner(crate_name!(), crate_version!()); - let args = commands::Cli::parse(); setup_env(args.config_env_file.as_ref()); - commands::execute(&args).await + + if !args.no_banner { + maybe_print_banner(crate_name!(), crate_version!()); + } + setup_logging(); + + commands::execute(args).await } diff --git a/clients/socks5/src/commands/build_info.rs b/clients/socks5/src/commands/build_info.rs new file mode 100644 index 0000000000..e3385bb933 --- /dev/null +++ b/clients/socks5/src/commands/build_info.rs @@ -0,0 +1,16 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use clap::Args; +use nym_bin_common::bin_info_owned; +use nym_bin_common::output_format::OutputFormat; + +#[derive(Args)] +pub(crate) struct BuildInfo { + #[clap(short, long, default_value_t = OutputFormat::default())] + output: OutputFormat, +} + +pub(crate) fn execute(args: BuildInfo) { + println!("{}", args.output.format(&bin_info_owned!())) +} diff --git a/clients/socks5/src/commands/mod.rs b/clients/socks5/src/commands/mod.rs index 12b4523330..393429246d 100644 --- a/clients/socks5/src/commands/mod.rs +++ b/clients/socks5/src/commands/mod.rs @@ -10,7 +10,7 @@ use clap::CommandFactory; use clap::{Parser, Subcommand}; use lazy_static::lazy_static; use log::{error, info}; -use nym_bin_common::build_information::BinaryBuildInformation; +use nym_bin_common::bin_info; use nym_bin_common::completions::{fig_generate, ArgShell}; use nym_client_core::client::base_client::storage::gateway_details::{ OnDiskGatewayDetails, PersistedGatewayDetails, @@ -23,12 +23,12 @@ use nym_config::OptionalSet; use nym_sphinx::params::{PacketSize, PacketType}; use std::error::Error; +pub(crate) mod build_info; pub mod init; pub(crate) mod run; lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = - BinaryBuildInformation::new(env!("CARGO_PKG_VERSION")).pretty_print(); + pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); } // Helper for passing LONG_VERSION to clap @@ -43,6 +43,10 @@ pub(crate) struct Cli { #[clap(short, long)] pub(crate) config_env_file: Option, + /// Flag used for disabling the printed banner in tty. + #[clap(long)] + pub(crate) no_banner: bool, + #[clap(subcommand)] command: Commands, } @@ -55,6 +59,9 @@ pub(crate) enum Commands { /// Run the Nym client with provided configuration client optionally overriding set parameters Run(run::Run), + /// Show build information of this binary + BuildInfo(build_info::BuildInfo), + /// Generate shell completions Completions(ArgShell), @@ -76,12 +83,13 @@ pub(crate) struct OverrideConfig { outfox: bool, } -pub(crate) async fn execute(args: &Cli) -> Result<(), Box> { +pub(crate) async fn execute(args: Cli) -> Result<(), Box> { let bin_name = "nym-socks5-client"; - match &args.command { - Commands::Init(m) => init::execute(m).await?, - Commands::Run(m) => run::execute(m).await?, + match args.command { + Commands::Init(m) => init::execute(&m).await?, + Commands::Run(m) => run::execute(&m).await?, + Commands::BuildInfo(m) => build_info::execute(m), Commands::Completions(s) => s.generate(&mut Cli::command(), bin_name), Commands::GenerateFigSpec => fig_generate(&mut Cli::command(), bin_name), } diff --git a/clients/socks5/src/main.rs b/clients/socks5/src/main.rs index b592c62817..8e6d899652 100644 --- a/clients/socks5/src/main.rs +++ b/clients/socks5/src/main.rs @@ -13,10 +13,13 @@ pub mod error; #[tokio::main] async fn main() -> Result<(), Box> { - setup_logging(); - maybe_print_banner(crate_name!(), crate_version!()); - let args = commands::Cli::parse(); setup_env(args.config_env_file.as_ref()); - commands::execute(&args).await + + if !args.no_banner { + maybe_print_banner(crate_name!(), crate_version!()); + } + setup_logging(); + + commands::execute(args).await } diff --git a/common/bin-common/src/build_information/mod.rs b/common/bin-common/src/build_information/mod.rs index d4fa7dd5c6..064f8a60fa 100644 --- a/common/bin-common/src/build_information/mod.rs +++ b/common/bin-common/src/build_information/mod.rs @@ -5,9 +5,13 @@ // and be used by our smart contracts use serde::{Deserialize, Serialize}; +use std::fmt::{Display, Formatter}; #[derive(Debug)] pub struct BinaryBuildInformation { + /// Provides the name of the binary, i.e. the content of `CARGO_PKG_NAME` environmental variable. + pub binary_name: &'static str, + // VERGEN_BUILD_TIMESTAMP /// Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`. pub build_timestamp: &'static str, @@ -43,8 +47,9 @@ pub struct BinaryBuildInformation { impl BinaryBuildInformation { // explicitly require the build_version to be passed as it's binary specific - pub const fn new(build_version: &'static str) -> Self { + pub const fn new(binary_name: &'static str, build_version: &'static str) -> Self { BinaryBuildInformation { + binary_name, build_timestamp: env!("VERGEN_BUILD_TIMESTAMP"), build_version, commit_sha: env!("VERGEN_GIT_SHA"), @@ -58,6 +63,7 @@ impl BinaryBuildInformation { pub fn to_owned(&self) -> BinaryBuildInformationOwned { BinaryBuildInformationOwned { + binary_name: self.binary_name.to_owned(), build_timestamp: self.build_timestamp.to_owned(), build_version: self.build_version.to_owned(), commit_sha: self.commit_sha.to_owned(), @@ -70,39 +76,15 @@ impl BinaryBuildInformation { } pub fn pretty_print(&self) -> String { - format!( - r#" -{:<20}{} -{:<20}{} -{:<20}{} -{:<20}{} -{:<20}{} -{:<20}{} -{:<20}{} -{:<20}{} -"#, - "Build Timestamp:", - self.build_timestamp, - "Build Version:", - self.build_version, - "Commit SHA:", - self.commit_sha, - "Commit Date:", - self.commit_timestamp, - "Commit Branch:", - self.commit_branch, - "rustc Version:", - self.rustc_version, - "rustc Channel:", - self.rustc_channel, - "cargo Profile:", - self.cargo_profile, - ) + self.to_owned().to_string() } } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct BinaryBuildInformationOwned { + /// Provides the name of the binary, i.e. the content of `CARGO_PKG_NAME` environmental variable. + pub binary_name: String, + // VERGEN_BUILD_TIMESTAMP /// Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`. pub build_timestamp: String, @@ -135,3 +117,62 @@ pub struct BinaryBuildInformationOwned { /// Provides the cargo profile that was used for the build, for example `debug`. pub cargo_profile: String, } + +impl Display for BinaryBuildInformationOwned { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!( + f, + r#" +{:<20}{} +{:<20}{} +{:<20}{} +{:<20}{} +{:<20}{} +{:<20}{} +{:<20}{} +{:<20}{} +{:<20}{} +"#, + "Binary Name:", + self.binary_name, + "Build Timestamp:", + self.build_timestamp, + "Build Version:", + self.build_version, + "Commit SHA:", + self.commit_sha, + "Commit Date:", + self.commit_timestamp, + "Commit Branch:", + self.commit_branch, + "rustc Version:", + self.rustc_version, + "rustc Channel:", + self.rustc_channel, + "cargo Profile:", + self.cargo_profile, + ) + } +} + +// since this macro will get expanded at the callsite, it will pull in correct binary version +#[macro_export] +macro_rules! bin_info { + () => { + $crate::build_information::BinaryBuildInformation::new( + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION"), + ) + }; +} + +#[macro_export] +macro_rules! bin_info_owned { + () => { + $crate::build_information::BinaryBuildInformation::new( + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION"), + ) + .to_owned() + }; +} diff --git a/gateway/src/commands/build_info.rs b/gateway/src/commands/build_info.rs new file mode 100644 index 0000000000..e3385bb933 --- /dev/null +++ b/gateway/src/commands/build_info.rs @@ -0,0 +1,16 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use clap::Args; +use nym_bin_common::bin_info_owned; +use nym_bin_common::output_format::OutputFormat; + +#[derive(Args)] +pub(crate) struct BuildInfo { + #[clap(short, long, default_value_t = OutputFormat::default())] + output: OutputFormat, +} + +pub(crate) fn execute(args: BuildInfo) { + println!("{}", args.output.format(&bin_info_owned!())) +} diff --git a/gateway/src/commands/mod.rs b/gateway/src/commands/mod.rs index 15775ec757..ed70c8b203 100644 --- a/gateway/src/commands/mod.rs +++ b/gateway/src/commands/mod.rs @@ -18,6 +18,7 @@ use std::error::Error; use std::net::IpAddr; use std::path::PathBuf; +pub(crate) mod build_info; pub(crate) mod init; pub(crate) mod node_details; pub(crate) mod run; @@ -37,6 +38,9 @@ pub(crate) enum Commands { /// Sign text to prove ownership of this mixnode Sign(sign::Sign), + /// Show build information of this binary + BuildInfo(build_info::BuildInfo), + /// Generate shell completions Completions(ArgShell), @@ -67,6 +71,7 @@ pub(crate) async fn execute(args: Cli) -> Result<(), Box node_details::execute(m).await?, Commands::Run(m) => run::execute(m).await?, Commands::Sign(m) => sign::execute(m)?, + Commands::BuildInfo(m) => build_info::execute(m), Commands::Completions(s) => s.generate(&mut crate::Cli::command(), bin_name), Commands::GenerateFigSpec => fig_generate(&mut crate::Cli::command(), bin_name), } diff --git a/gateway/src/main.rs b/gateway/src/main.rs index 9ea8eb679d..5290037266 100644 --- a/gateway/src/main.rs +++ b/gateway/src/main.rs @@ -5,7 +5,7 @@ use clap::{crate_name, crate_version, Parser}; use colored::Colorize; use lazy_static::lazy_static; use log::error; -use nym_bin_common::build_information::BinaryBuildInformation; +use nym_bin_common::bin_info; use nym_bin_common::logging::{maybe_print_banner, setup_logging}; use nym_bin_common::output_format::OutputFormat; use nym_network_defaults::setup_env; @@ -18,8 +18,7 @@ mod node; pub(crate) mod support; lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = - BinaryBuildInformation::new(env!("CARGO_PKG_VERSION")).pretty_print(); + pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); } // Helper for passing LONG_VERSION to clap @@ -34,18 +33,24 @@ struct Cli { #[clap(short, long)] pub(crate) config_env_file: Option, + /// Flag used for disabling the printed banner in tty. + #[clap(long)] + pub(crate) no_banner: bool, + #[clap(subcommand)] command: commands::Commands, } #[tokio::main] async fn main() -> Result<(), Box> { - setup_logging(); - maybe_print_banner(crate_name!(), crate_version!()); - let args = Cli::parse(); setup_env(args.config_env_file.as_ref()); + if !args.no_banner { + maybe_print_banner(crate_name!(), crate_version!()); + } + setup_logging(); + commands::execute(args).await.map_err(|err| { if atty::is(atty::Stream::Stdout) { let error_message = format!("{err}").red(); diff --git a/mixnode/src/commands/build_info.rs b/mixnode/src/commands/build_info.rs new file mode 100644 index 0000000000..e3385bb933 --- /dev/null +++ b/mixnode/src/commands/build_info.rs @@ -0,0 +1,16 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use clap::Args; +use nym_bin_common::bin_info_owned; +use nym_bin_common::output_format::OutputFormat; + +#[derive(Args)] +pub(crate) struct BuildInfo { + #[clap(short, long, default_value_t = OutputFormat::default())] + output: OutputFormat, +} + +pub(crate) fn execute(args: BuildInfo) { + println!("{}", args.output.format(&bin_info_owned!())) +} diff --git a/mixnode/src/commands/mod.rs b/mixnode/src/commands/mod.rs index b8c8f84894..e79df8e2ab 100644 --- a/mixnode/src/commands/mod.rs +++ b/mixnode/src/commands/mod.rs @@ -15,6 +15,7 @@ use nym_crypto::bech32_address_validation; use std::net::IpAddr; use std::process; +mod build_info; mod describe; mod init; mod node_details; @@ -38,6 +39,9 @@ pub(crate) enum Commands { /// Show details of this mixnode NodeDetails(node_details::NodeDetails), + /// Show build information of this binary + BuildInfo(build_info::BuildInfo), + /// Generate shell completions Completions(ArgShell), @@ -64,6 +68,7 @@ pub(crate) async fn execute(args: Cli) -> anyhow::Result<()> { Commands::Run(m) => run::execute(&m).await?, Commands::Sign(m) => sign::execute(&m)?, Commands::NodeDetails(m) => node_details::execute(&m)?, + Commands::BuildInfo(m) => build_info::execute(m), Commands::Completions(s) => s.generate(&mut crate::Cli::command(), bin_name), Commands::GenerateFigSpec => fig_generate(&mut crate::Cli::command(), bin_name), } diff --git a/mixnode/src/main.rs b/mixnode/src/main.rs index 5681e02cc7..bdda653edf 100644 --- a/mixnode/src/main.rs +++ b/mixnode/src/main.rs @@ -7,7 +7,8 @@ extern crate rocket; use ::nym_config::defaults::setup_env; use clap::{crate_name, crate_version, Parser}; use lazy_static::lazy_static; -use nym_bin_common::build_information::BinaryBuildInformation; +use nym_bin_common::bin_info; + #[allow(unused_imports)] use nym_bin_common::logging::{maybe_print_banner, setup_logging}; #[cfg(feature = "cpucycles")] @@ -16,13 +17,13 @@ use nym_bin_common::setup_tracing; use nym_mixnode_common::measure; #[cfg(feature = "cpucycles")] use tracing::instrument; + mod commands; mod config; mod node; lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = - BinaryBuildInformation::new(env!("CARGO_PKG_VERSION")).pretty_print(); + pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); } // Helper for passing LONG_VERSION to clap @@ -37,6 +38,10 @@ struct Cli { #[clap(short, long)] pub(crate) config_env_file: Option, + /// Flag used for disabling the printed banner in tty. + #[clap(long)] + pub(crate) no_banner: bool, + #[clap(subcommand)] command: commands::Commands, } @@ -49,6 +54,13 @@ fn test_function() { #[tokio::main] async fn main() -> anyhow::Result<()> { + let args = Cli::parse(); + setup_env(args.config_env_file.as_ref()); + + if !args.no_banner { + maybe_print_banner(crate_name!(), crate_version!()); + } + cfg_if::cfg_if! { if #[cfg(feature = "cpucycles")] { setup_tracing!("mixnode"); @@ -59,10 +71,6 @@ async fn main() -> anyhow::Result<()> { } } - maybe_print_banner(crate_name!(), crate_version!()); - - let args = Cli::parse(); - setup_env(args.config_env_file.as_ref()); commands::execute(args).await?; cfg_if::cfg_if! { diff --git a/nym-api/src/support/cli/mod.rs b/nym-api/src/support/cli/mod.rs index 1bcc518ad4..e638d29c09 100644 --- a/nym-api/src/support/cli/mod.rs +++ b/nym-api/src/support/cli/mod.rs @@ -8,14 +8,13 @@ use ::nym_config::defaults::var_names::{MIXNET_CONTRACT_ADDRESS, VESTING_CONTRAC use anyhow::Result; use clap::Parser; use lazy_static::lazy_static; -use nym_bin_common::build_information::BinaryBuildInformation; +use nym_bin_common::bin_info; use nym_config::defaults::var_names::NYXD; use nym_config::OptionalSet; use nym_validator_client::nyxd; lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = - BinaryBuildInformation::new(env!("CARGO_PKG_VERSION")).pretty_print(); + pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); } // Helper for passing LONG_VERSION to clap diff --git a/service-providers/network-requester/src/cli/build_info.rs b/service-providers/network-requester/src/cli/build_info.rs new file mode 100644 index 0000000000..e3385bb933 --- /dev/null +++ b/service-providers/network-requester/src/cli/build_info.rs @@ -0,0 +1,16 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use clap::Args; +use nym_bin_common::bin_info_owned; +use nym_bin_common::output_format::OutputFormat; + +#[derive(Args)] +pub(crate) struct BuildInfo { + #[clap(short, long, default_value_t = OutputFormat::default())] + output: OutputFormat, +} + +pub(crate) fn execute(args: BuildInfo) { + println!("{}", args.output.format(&bin_info_owned!())) +} diff --git a/service-providers/network-requester/src/cli/mod.rs b/service-providers/network-requester/src/cli/mod.rs index e6a34432df..80dd4751a5 100644 --- a/service-providers/network-requester/src/cli/mod.rs +++ b/service-providers/network-requester/src/cli/mod.rs @@ -10,7 +10,7 @@ use crate::{ }; use clap::{CommandFactory, Parser, Subcommand}; use log::{error, info}; -use nym_bin_common::build_information::BinaryBuildInformation; +use nym_bin_common::bin_info; use nym_bin_common::completions::{fig_generate, ArgShell}; use nym_bin_common::version_checker; use nym_client_core::client::base_client::storage::gateway_details::{ @@ -21,13 +21,13 @@ use nym_client_core::config::GatewayEndpointConfig; use nym_client_core::error::ClientCoreError; use nym_sphinx::params::PacketSize; +mod build_info; mod init; mod run; mod sign; lazy_static::lazy_static! { - pub static ref PRETTY_BUILD_INFORMATION: String = - BinaryBuildInformation::new(env!("CARGO_PKG_VERSION")).pretty_print(); + pub static ref PRETTY_BUILD_INFORMATION: String = bin_info!().pretty_print(); } // Helper for passing LONG_VERSION to clap @@ -42,6 +42,10 @@ pub(crate) struct Cli { #[clap(short, long)] pub(crate) config_env_file: Option, + /// Flag used for disabling the printed banner in tty. + #[clap(long)] + pub(crate) no_banner: bool, + #[clap(subcommand)] command: Commands, } @@ -59,6 +63,9 @@ pub(crate) enum Commands { /// Sign to prove ownership of this network requester Sign(sign::Sign), + /// Show build information of this binary + BuildInfo(build_info::BuildInfo), + /// Generate shell completions Completions(ArgShell), @@ -119,10 +126,11 @@ pub(crate) fn override_config(config: Config, args: OverrideConfig) -> Config { pub(crate) async fn execute(args: Cli) -> Result<(), NetworkRequesterError> { let bin_name = "nym-network-requester"; - match &args.command { - Commands::Init(m) => init::execute(m).await?, - Commands::Run(m) => run::execute(m).await?, - Commands::Sign(m) => sign::execute(m).await?, + match args.command { + Commands::Init(m) => init::execute(&m).await?, + Commands::Run(m) => run::execute(&m).await?, + Commands::Sign(m) => sign::execute(&m).await?, + Commands::BuildInfo(m) => build_info::execute(m), Commands::Completions(s) => s.generate(&mut Cli::command(), bin_name), Commands::GenerateFigSpec => fig_generate(&mut Cli::command(), bin_name), } diff --git a/service-providers/network-requester/src/core.rs b/service-providers/network-requester/src/core.rs index b60bc30f41..92ab7af231 100644 --- a/service-providers/network-requester/src/core.rs +++ b/service-providers/network-requester/src/core.rs @@ -13,7 +13,7 @@ use crate::{reply, socks5}; use async_trait::async_trait; use futures::channel::mpsc; use log::warn; -use nym_bin_common::build_information::BinaryBuildInformation; +use nym_bin_common::bin_info_owned; use nym_client_core::config::disk_persistence::CommonClientPaths; use nym_network_defaults::NymNetworkDetails; use nym_service_providers_common::interface::{ @@ -101,7 +101,7 @@ impl ServiceProvider for NRServiceProvider { ) -> Result { Ok(BinaryInformation { binary_name: env!("CARGO_PKG_NAME").to_string(), - build_information: BinaryBuildInformation::new(env!("CARGO_PKG_VERSION")).to_owned(), + build_information: bin_info_owned!(), }) } diff --git a/service-providers/network-requester/src/main.rs b/service-providers/network-requester/src/main.rs index 696cb41c21..89ac717d37 100644 --- a/service-providers/network-requester/src/main.rs +++ b/service-providers/network-requester/src/main.rs @@ -18,11 +18,13 @@ mod statistics; #[tokio::main] async fn main() -> Result<(), NetworkRequesterError> { - setup_logging(); - maybe_print_banner(crate_name!(), crate_version!()); - let args = cli::Cli::parse(); setup_env(args.config_env_file.as_ref()); + if !args.no_banner { + maybe_print_banner(crate_name!(), crate_version!()); + } + setup_logging(); + cli::execute(args).await }