fix: No root certificates in scratch container
This commit is contained in:
@@ -4,6 +4,7 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
reqwest = { workspace = true }
|
||||
automation_macro = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
automation_cast = { workspace = true }
|
||||
@@ -21,3 +22,4 @@ serde_json = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
webpki-root-certs = "1.0.8"
|
||||
|
||||
@@ -13,6 +13,7 @@ pub mod helpers;
|
||||
pub mod lua;
|
||||
pub mod messages;
|
||||
pub mod mqtt;
|
||||
pub mod reqwest;
|
||||
|
||||
type RegisterFn = fn(lua: &mlua::Lua) -> mlua::Result<mlua::Table>;
|
||||
type DefinitionsFn = fn() -> String;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
use reqwest::{Certificate, Client};
|
||||
|
||||
pub fn new_client() -> Client {
|
||||
Client::builder()
|
||||
.user_agent(format!(
|
||||
"{}/{}",
|
||||
std::env!("CARGO_PKG_NAME"),
|
||||
std::env!("CARGO_PKG_VERSION")
|
||||
))
|
||||
.tls_certs_only(
|
||||
webpki_root_certs::TLS_SERVER_ROOT_CERTS
|
||||
.iter()
|
||||
.map(|cert| Certificate::from_der(cert).unwrap()),
|
||||
)
|
||||
.build()
|
||||
.expect("Client should build")
|
||||
}
|
||||
Reference in New Issue
Block a user