Feeding a config object to the directory client
This commit is contained in:
@@ -8,8 +8,12 @@ mod healthcheck;
|
||||
mod metrics;
|
||||
mod presence;
|
||||
|
||||
pub struct Config {
|
||||
pub base_url: String,
|
||||
}
|
||||
|
||||
pub trait DirectoryClient {
|
||||
fn new(base_url: String) -> Self;
|
||||
fn new(config : Config) -> Self;
|
||||
fn get_topology(&self) -> Result<Topology, reqwest::Error>;
|
||||
// fn send_provider_presence(&self) -> Result<ProviderPresenceResponse, reqwest::Error>;
|
||||
}
|
||||
@@ -17,7 +21,7 @@ pub trait DirectoryClient {
|
||||
pub struct Client {}
|
||||
|
||||
impl DirectoryClient for Client {
|
||||
fn new(base_url: String) -> Client {
|
||||
fn new(config: Config) -> Client {
|
||||
let topology = retrieve_topology().unwrap();
|
||||
Client {}
|
||||
}
|
||||
|
||||
+4
-1
@@ -55,7 +55,10 @@ fn run(matches: &ArgMatches) {
|
||||
let message = format!("Hello, Sphinx {}", i).as_bytes().to_vec();
|
||||
|
||||
// set up the route
|
||||
let directory= directory::Client::new("https://directory.nymtech.net".to_string());
|
||||
let directory_config = directory::Config {
|
||||
base_url: "https://directory.nymtech.net".to_string()
|
||||
};
|
||||
let directory= directory::Client::new(directory_config);
|
||||
// let route = directory.get_mixes();
|
||||
// let destination = directory.get_destination();
|
||||
let delays = sphinx::header::delays::generate(2);
|
||||
|
||||
Reference in New Issue
Block a user