refactor(tauri-codegen): panic if local IP address cannot be resolved

This commit is contained in:
Lucas Nogueira
2022-09-01 16:58:41 -03:00
parent 349895b296
commit aae91a9b53

View File

@@ -167,9 +167,8 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
_ => false,
};
if localhost {
if let Ok(ip) = local_ip_address::local_ip() {
url.set_host(Some(&ip.to_string())).unwrap();
}
let ip = local_ip_address::local_ip().expect("failed to resolve local IP address");
url.set_host(Some(&ip.to_string())).unwrap();
}
}
}