Cli: some moniker follow-up (#14981)
* Enable monikers in config set * Fixup websocket compute
This commit is contained in:
@ -471,11 +471,15 @@ impl CliConfig<'_> {
|
|||||||
(SettingType::Explicit, websocket_cfg_url.to_string()),
|
(SettingType::Explicit, websocket_cfg_url.to_string()),
|
||||||
(
|
(
|
||||||
SettingType::Computed,
|
SettingType::Computed,
|
||||||
solana_cli_config::Config::compute_websocket_url(json_rpc_cmd_url),
|
solana_cli_config::Config::compute_websocket_url(&normalize_to_url_if_moniker(
|
||||||
|
json_rpc_cmd_url,
|
||||||
|
)),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
SettingType::Computed,
|
SettingType::Computed,
|
||||||
solana_cli_config::Config::compute_websocket_url(json_rpc_cfg_url),
|
solana_cli_config::Config::compute_websocket_url(&normalize_to_url_if_moniker(
|
||||||
|
json_rpc_cfg_url,
|
||||||
|
)),
|
||||||
),
|
),
|
||||||
(SettingType::SystemDefault, Self::default_websocket_url()),
|
(SettingType::SystemDefault, Self::default_websocket_url()),
|
||||||
])
|
])
|
||||||
|
@ -4,7 +4,7 @@ use clap::{
|
|||||||
};
|
};
|
||||||
use console::style;
|
use console::style;
|
||||||
use solana_clap_utils::{
|
use solana_clap_utils::{
|
||||||
input_validators::{is_url, is_url_or_moniker},
|
input_validators::{is_url, is_url_or_moniker, normalize_to_url_if_moniker},
|
||||||
keypair::{CliSigners, DefaultSigner, SKIP_SEED_PHRASE_VALIDATION_ARG},
|
keypair::{CliSigners, DefaultSigner, SKIP_SEED_PHRASE_VALIDATION_ARG},
|
||||||
DisplayError,
|
DisplayError,
|
||||||
};
|
};
|
||||||
@ -90,7 +90,7 @@ fn parse_settings(matches: &ArgMatches<'_>) -> Result<bool, Box<dyn error::Error
|
|||||||
}
|
}
|
||||||
("set", Some(subcommand_matches)) => {
|
("set", Some(subcommand_matches)) => {
|
||||||
if let Some(url) = subcommand_matches.value_of("json_rpc_url") {
|
if let Some(url) = subcommand_matches.value_of("json_rpc_url") {
|
||||||
config.json_rpc_url = url.to_string();
|
config.json_rpc_url = normalize_to_url_if_moniker(url);
|
||||||
// Revert to a computed `websocket_url` value when `json_rpc_url` is
|
// Revert to a computed `websocket_url` value when `json_rpc_url` is
|
||||||
// changed
|
// changed
|
||||||
config.websocket_url = "".to_string();
|
config.websocket_url = "".to_string();
|
||||||
|
Reference in New Issue
Block a user