aboutsummaryrefslogtreecommitdiff
path: root/src/proxy_config.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-12-07 18:31:04 +0100
committerAlex Auvolat <alex@adnab.me>2021-12-07 18:31:04 +0100
commit9119c2f45c348497ea8d2f2f73768f50a198c4af (patch)
tree2f3c70f0c0377419efe2c3ed01c4162653114153 /src/proxy_config.rs
parent489d364676003fa08130689a9f509de7d4df1602 (diff)
downloadtricot-9119c2f45c348497ea8d2f2f73768f50a198c4af.tar.gz
tricot-9119c2f45c348497ea8d2f2f73768f50a198c4af.zip
Use node IP when service IP is not available
Diffstat (limited to 'src/proxy_config.rs')
-rw-r--r--src/proxy_config.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/proxy_config.rs b/src/proxy_config.rs
index 9d07604..3e3e62f 100644
--- a/src/proxy_config.rs
+++ b/src/proxy_config.rs
@@ -86,7 +86,13 @@ fn parse_consul_catalog(catalog: &ConsulNodeCatalog) -> Vec<ProxyEntry> {
for (_, svc) in catalog.services.iter() {
let ip_addr = match svc.address.parse() {
Ok(ip) => ip,
- _ => continue,
+ _ => match catalog.node.address.parse() {
+ Ok(ip) => ip,
+ _ => {
+ warn!("Could not get address for service {} at node {}", svc.service, catalog.node.node);
+ continue;
+ }
+ }
};
let addr = SocketAddr::new(ip_addr, svc.port);
@@ -178,7 +184,8 @@ pub fn spawn_proxy_config_task(consul: Consul) -> watch::Receiver<Arc<ProxyConfi
let will_retry_in = retry_to_time(watch_state.retries, Duration::from_secs(600));
error!(
- "Failed to query consul. Will retry in {}s. {}",
+ "Failed to query consul for node {}. Will retry in {}s. {}",
+ node,
will_retry_in.as_secs(),
e
);