- chore: ran cargo fix on the codebase
This commit is contained in:
@@ -2,8 +2,8 @@ use reqwest::Client;
|
||||
use serde::Serialize;
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::net::ToSocketAddrs;
|
||||
use std::fs;
|
||||
use std::net::ToSocketAddrs;
|
||||
use std::path::Path;
|
||||
use uuid::Uuid;
|
||||
use warp::Filter;
|
||||
@@ -52,8 +52,6 @@ pub fn get_or_generate_service_id(package_name: &str) -> String {
|
||||
service_id
|
||||
}
|
||||
|
||||
|
||||
|
||||
pub async fn register_service(
|
||||
consul_url: &str,
|
||||
service_id: &str,
|
||||
@@ -64,7 +62,6 @@ pub async fn register_service(
|
||||
mut meta: HashMap<String, String>,
|
||||
health_check_url: &str,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
meta.insert("version".to_string(), VERSION.to_string());
|
||||
let registration = ConsulRegistration {
|
||||
id: service_id.to_string(),
|
||||
@@ -92,9 +89,13 @@ pub async fn register_service(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn deregister_service(consul_url: &str, service_id: &str) -> Result<(), Box<dyn std::error::Error>> {
|
||||
pub async fn deregister_service(
|
||||
consul_url: &str,
|
||||
service_id: &str,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let client = Client::new();
|
||||
let consul_deregister_url = format!("{}/v1/agent/service/deregister/{}", consul_url, service_id);
|
||||
let consul_deregister_url =
|
||||
format!("{}/v1/agent/service/deregister/{}", consul_url, service_id);
|
||||
|
||||
client
|
||||
.put(&consul_deregister_url)
|
||||
@@ -115,7 +116,14 @@ pub async fn start_health_check(service_address: &str) -> Result<(), Box<dyn std
|
||||
.map(|| warp::reply::with_status("OK", warp::http::StatusCode::OK))
|
||||
.with(log);
|
||||
|
||||
tokio::spawn(warp::serve(health_route).run(health_check_endpoint_addr.to_socket_addrs()?.next().unwrap()));
|
||||
|
||||
tokio::spawn(
|
||||
warp::serve(health_route).run(
|
||||
health_check_endpoint_addr
|
||||
.to_socket_addrs()?
|
||||
.next()
|
||||
.unwrap(),
|
||||
),
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user