difftreelog
Use env var as node name
in: master
2 files changed
node/cli/src/cli.rsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use crate::chain_spec;17use crate::chain_spec;18use std::path::PathBuf;18use std::{path::PathBuf, env};19use clap::Parser;19use clap::Parser;2021const NODE_NAME_ENV: &str = "UNIQUE_NODE_NAME";202221/// Sub-commands supported by the collator.23/// Sub-commands supported by the collator.22#[derive(Debug, Parser)]24#[derive(Debug, Parser)]107 pub relaychain_args: Vec<String>,109 pub relaychain_args: Vec<String>,108}110}111112impl Cli {113 pub fn node_name() -> String {114 env::var(NODE_NAME_ENV).unwrap_or("Unknown".into())115 }116}109117110#[derive(Debug)]118#[derive(Debug)]111pub struct RelayChainCli {119pub struct RelayChainCli {node/cli/src/command.rsdiffbeforeafterboth--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -99,7 +99,7 @@
impl SubstrateCli for Cli {
// TODO use args
fn impl_name() -> String {
- "Unique Node".into()
+ format!("{} Node", Self::node_name())
}
fn impl_version() -> String {
@@ -108,10 +108,11 @@
// TODO use args
fn description() -> String {
format!(
- "Unique Node\n\nThe command-line arguments provided first will be \
+ "{} Node\n\nThe command-line arguments provided first will be \
passed to the parachain node, while the arguments provided after -- will be passed \
to the relaychain node.\n\n\
{} [parachain-args] -- [relaychain-args]",
+ Self::node_name(),
Self::executable_name()
)
}
@@ -150,7 +151,7 @@
impl SubstrateCli for RelayChainCli {
// TODO use args
fn impl_name() -> String {
- "Unique Node".into()
+ format!("{} Node", Cli::node_name())
}
fn impl_version() -> String {
@@ -158,11 +159,13 @@
}
// TODO use args
fn description() -> String {
- "Unique Node\n\nThe command-line arguments provided first will be \
- passed to the parachain node, while the arguments provided after -- will be passed \
- to the relaychain node.\n\n\
- parachain-collator [parachain-args] -- [relaychain-args]"
- .into()
+ format!(
+ "{} Node\n\nThe command-line arguments provided first will be \
+ passed to the parachain node, while the arguments provided after -- will be passed \
+ to the relaychain node.\n\n\
+ parachain-collator [parachain-args] -- [relaychain-args]",
+ Cli::node_name()
+ )
}
fn author() -> String {