From b32e1575a38a80ee5499c7c6b6e970891287a755 Mon Sep 17 00:00:00 2001 From: Dave Hrycyszyn Date: Mon, 16 Dec 2019 11:41:00 +0000 Subject: [PATCH 1/2] main: removed unused customcfg option --- src/main.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index cf053edfac..e9a2a27091 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,21 +26,14 @@ fn main() { .help("Id of the provider we have preference to connect to. If left empty, a random provider will be chosen.") .takes_value(true) ) - .arg(Arg::with_name("local") - .long("local") - .help("Flag to indicate whether the client is expected to run on the local deployment.") - .takes_value(true) - ) ) .subcommand( SubCommand::with_name("run") .about("Run a persistent Nym client process") - .arg( - Arg::with_name("customCfg") - .short("cfg") - .long("customCfg") - .help("Path to custom configuration file of the client") - .takes_value(true) + .arg(Arg::with_name("local") + .long("local") + .help("Flag to indicate whether the client is expected to run on the local deployment.") + .takes_value(false) ) ) .subcommand( From d9a603aa1f394aa5ce34afd9ef580d6cad60508e Mon Sep 17 00:00:00 2001 From: Dave Hrycyszyn Date: Mon, 16 Dec 2019 11:41:18 +0000 Subject: [PATCH 2/2] run command: added the ability to start with a local directory server --- src/commands/run.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/commands/run.rs b/src/commands/run.rs index 9a72186984..c6567fe037 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -15,11 +15,11 @@ use tokio::runtime::Runtime; use tokio::time::{interval_at, Instant}; pub fn execute(matches: &ArgMatches) { - let custom_cfg = matches.value_of("customCfg"); - println!("Starting client with config: {:?}", custom_cfg); + let is_local = matches.is_present("local"); + println!("Starting client, local: {:?}", is_local); // Grab the network topology from the remote directory server - let topology = get_topology(); + let topology = get_topology(is_local); // Create the runtime, probably later move it to Client struct itself? let mut rt = Runtime::new().unwrap(); @@ -61,10 +61,14 @@ pub fn execute(matches: &ArgMatches) { }) } -fn get_topology() -> Topology { - let directory_config = directory::Config { - base_url: "https://directory.nymtech.net".to_string(), +fn get_topology(is_local: bool) -> Topology { + let url = if is_local { + "http://localhost:8080".to_string() + } else { + "https://directory.nymtech.net".to_string() }; + println!("Using directory server: {:?}", url); + let directory_config = directory::Config { base_url: url }; let directory = directory::Client::new(directory_config); let topology = directory