diff options
author | Alex Auvolat <alex@adnab.me> | 2023-01-05 11:27:18 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-01-05 11:27:18 +0100 |
commit | 19220178311ca80374f6f5ff4069c0adcaab932d (patch) | |
tree | 0c93f733cda141a39474f79b69d4658523cf5278 /examples | |
parent | b0af49c24c0f8e006e02704d398318cf74ae1d6f (diff) | |
download | df-consul-19220178311ca80374f6f5ff4069c0adcaab932d.tar.gz df-consul-19220178311ca80374f6f5ff4069c0adcaab932d.zip |
Properly handle empty node catalog
Diffstat (limited to 'examples')
-rw-r--r-- | examples/test.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/test.rs b/examples/test.rs new file mode 100644 index 0000000..e7c34c8 --- /dev/null +++ b/examples/test.rs @@ -0,0 +1,24 @@ +use df_consul::*; + +#[tokio::main] +async fn main() { + let config = ConsulConfig { + addr: "http://localhost:8500".into(), + ca_cert: None, + tls_skip_verify: false, + client_cert: None, + client_key: None, + }; + + let consul = Consul::new(config, "").unwrap(); + + println!("== LIST NODES =="); + let list_nodes = consul.list_nodes().await.unwrap(); + println!("{:?}", list_nodes); + + println!("== CATALOG 1 =="); + println!("{:?}", consul.watch_node("caribou", None).await.unwrap()); + + println!("== CATALOG 2 =="); + println!("{:?}", consul.watch_node("cariacou", None).await.unwrap()); +} |