Skip to content

Commit

Permalink
get TcpFrontends::tags out of its Option<>
Browse files Browse the repository at this point in the history
  • Loading branch information
Keksoj committed May 4, 2023
1 parent a1c02b6 commit b978a89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions command/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,16 @@ impl std::fmt::Display for PathRule {
pub struct TcpFrontend {
pub cluster_id: String,
pub address: SocketAddr,
// TODO: remove the Option here, the map may as well be empty
/// custom tags to identify the frontend in the access logs
pub tags: Option<BTreeMap<String, String>>,
pub tags: BTreeMap<String, String>,
}

impl Into<RequestTcpFrontend> for TcpFrontend {
fn into(self) -> RequestTcpFrontend {
RequestTcpFrontend {
cluster_id: self.cluster_id,
address: self.address.to_string(),
tags: self.tags.unwrap_or(BTreeMap::new()),
tags: self.tags.clone(),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion command/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ impl ConfigState {
.address
.parse()
.with_context(|| "wrong socket address")?,
tags: Some(front.tags.clone()),
tags: front.tags.clone(),
};
if tcp_frontends.contains(&tcp_frontend) {
bail!("This tcp frontend is already present: {:?}", tcp_frontend);
Expand Down

0 comments on commit b978a89

Please sign in to comment.