From 91e157815a71f881a5d85cff6313905307236289 Mon Sep 17 00:00:00 2001 From: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> Date: Tue, 25 Aug 2026 08:35:25 +0530 Subject: [PATCH] fix: clearer MOSTRO_PUBKEY and RELAYS setup guidance - Provide 2 primary input methods (flag and env var) - Add note explaining CLI does not read config files with sourcing tip and docs link - Align MOSTRO_PUBKEY and RELAYS missing config error messages Fixes #184 Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> --- src/cli.rs | 12 ++++++++++-- tests/cli_functions.rs | 12 ++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 926258d..bafc08d 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -471,7 +471,11 @@ fn resolve_mostro_pubkey(cli: &Cli) -> Result { "MOSTRO_PUBKEY not set.\n\ Provide it using one of the following methods:\n\ 1) --mostropubkey \n\ - 2) export MOSTRO_PUBKEY=" + 2) export MOSTRO_PUBKEY=\n\n\ + mostro-cli does not read any config file. To avoid re-exporting every\n\ + time, put the exports in a file (e.g. ~/.config/mostro/env.sh) and\n\ + `source` it before running the CLI.\n\ + See https://github.com/MostroP2P/mostro-cli#configuration" ) }) } @@ -487,7 +491,11 @@ fn resolve_relays() -> Result { "RELAYS not set.\n\ Provide it using one of the following methods:\n\ 1) --relays \n\ - 2) export RELAYS=" + 2) export RELAYS=\n\n\ + mostro-cli does not read any config file. To avoid re-exporting every\n\ + time, put the exports in a file (e.g. ~/.config/mostro/env.sh) and\n\ + `source` it before running the CLI.\n\ + See https://github.com/MostroP2P/mostro-cli#configuration" )), } } diff --git a/tests/cli_functions.rs b/tests/cli_functions.rs index 1faaec4..768722a 100644 --- a/tests/cli_functions.rs +++ b/tests/cli_functions.rs @@ -373,3 +373,15 @@ mod maintenance_commands { ); } } + +// ── missing configuration guidance ───────────────────────────────────────── +mod missing_config_guidance { + use clap::Parser; + use mostro_client::cli::Cli; + + #[test] + fn missing_mostro_pubkey_message_content() { + let cli = Cli::try_parse_from(["mostro-cli", "listorders"]).unwrap(); + assert!(cli.mostropubkey.is_none()); + } +}