aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/consul_services.rs
diff options
context:
space:
mode:
authorRoberto Hidalgo <un@rob.mx>2023-05-08 19:29:47 -0600
committerRoberto Hidalgo <un@rob.mx>2023-05-22 08:57:15 -0600
commitbd6485565e78c0bbb9ee830c4e5b114c6248dc97 (patch)
tree4afbdbbd65eb29c3eb50d96a53aff91450ba3b7a /src/rpc/consul_services.rs
parent4d6e6fc155bb263a04f7f6dfbb77933f5d2d0b2e (diff)
downloadgarage-bd6485565e78c0bbb9ee830c4e5b114c6248dc97.tar.gz
garage-bd6485565e78c0bbb9ee830c4e5b114c6248dc97.zip
allow additional ServiceMeta, docs
Diffstat (limited to 'src/rpc/consul_services.rs')
-rw-r--r--src/rpc/consul_services.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/rpc/consul_services.rs b/src/rpc/consul_services.rs
index 928c7691..aaf3c4a1 100644
--- a/src/rpc/consul_services.rs
+++ b/src/rpc/consul_services.rs
@@ -129,17 +129,22 @@ impl ConsulServiceDiscovery {
]
.concat();
+ let mut meta = HashMap::from([
+ (format!("{}-pubkey", META_PREFIX), hex::encode(node_id)),
+ (format!("{}-hostname", META_PREFIX), hostname.to_string()),
+ ]);
+
+ if let Some(global_meta) = &self.config.meta {
+ for (key, value) in global_meta.into_iter() {
+ meta.insert(key.clone(), value.clone());
+ }
+ }
+
let advertisement: ConsulPublishService = ConsulPublishService {
service_id: node.clone(),
service_name: self.config.service_name.clone(),
tags,
- meta: [
- (format!("{}-pubkey", META_PREFIX), hex::encode(node_id)),
- (format!("{}-hostname", META_PREFIX), hostname.to_string()),
- ]
- .iter()
- .cloned()
- .collect(),
+ meta,
address: rpc_public_addr.ip(),
port: rpc_public_addr.port(),
};