nzr-api: ensure / is at the end of the ci url

Without it, cloud-init tries accessing `http://1.1.1.1:80meta-data`.
This commit is contained in:
snow flurry 2024-08-15 19:25:24 -07:00
parent c35d9ccbed
commit deaaaa3d10

View file

@ -56,9 +56,13 @@ pub struct CloudConfig {
impl CloudConfig {
pub fn http_addr(&self) -> String {
if let Some(http_addr) = &self.http_addr {
http_addr.clone()
if http_addr.ends_with('/') {
http_addr.clone()
} else {
format!("{}/", http_addr)
}
} else {
format!("http://{}:{}", self.listen_addr, self.port)
format!("http://{}:{}/", self.listen_addr, self.port)
}
}
}