feat(tls): add TLS provider initialization and integrate with van-weather

This commit is contained in:
Richie committed 2026-10-16 21:03:04 -04:00
1 parent 8a11cb4659
commit 3960254b27
4 files changed
+42 -1

No files matched your search

+10
View File
@@ -13,6 +13,7 @@ use reqwest::{
};
use serde::Deserialize;
use serde_json::{Value, json};
use tls::install_tls_provider;
const LAT_ENTITY: &str = "sensor.van_last_known_latitude";
const LON_ENTITY: &str = "sensor.van_last_known_longitude";
@@ -159,6 +160,7 @@ fn main() -> Result<()> {
} = Args::parse();
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or(log_level.as_str()))
.init();
install_tls_provider()?;
let ha_url = ha_url.trim_end_matches('/').to_owned();
let ha_host = Url::parse(&ha_url)
@@ -494,6 +496,14 @@ fn percent(value: Option<f64>) -> i64 {
mod tests {
use super::*;
#[test]
fn builds_http_clients_with_aws_lc() -> Result<()> {
install_tls_provider()?;
build_client("home-assistant.example", Some("test-token"))?;
build_client(PIRATE_WEATHER_HOST, None)?;
Ok(())
}
#[test]
fn maps_conditions_for_home_assistant() {
assert_eq!(condition(Some("clear-day")), "sunny");