removed separate port field from config for backends

This commit is contained in:
psun256
2025-12-10 20:40:27 -05:00
parent 0496594bfa
commit 36026049f9
3 changed files with 19 additions and 20 deletions

View File

@@ -36,11 +36,9 @@ pub fn build_lb(
let mut backends: HashMap<String, Arc<Backend>> = HashMap::new();
for backend_cfg in &config.backends {
let ip: IpAddr = backend_cfg
.ip
.parse()
let addr: SocketAddr = backend_cfg.ip.parse()
.map_err(|_| format!("bad ip: {}", backend_cfg.ip))?;
let addr = SocketAddr::new(ip, backend_cfg.port);
let ip = addr.ip();
let health = healths
.entry(ip)

View File

@@ -44,7 +44,6 @@ pub struct AppConfig {
pub struct BackendConfig {
pub id: String,
pub ip: String,
pub port: u16,
}
#[derive(Debug, Deserialize)]