Merge pull request #25 from nymtech/feature/directory-server-option
Feature/directory server option
This commit is contained in:
+10
-6
@@ -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
|
||||
|
||||
+4
-11
@@ -27,21 +27,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(
|
||||
|
||||
Reference in New Issue
Block a user