fix: allow invalid certs
This commit is contained in:
@ -14,7 +14,7 @@ pub struct Cloudflare {
|
||||
impl Cloudflare {
|
||||
pub fn new(token: &str, reverse_zone_id: &str, forward_zone_id: &str) -> Cloudflare {
|
||||
Self {
|
||||
api: JsonApi::token("https://api.cloudflare.com", &format!("Bearer {}", token))
|
||||
api: JsonApi::token("https://api.cloudflare.com", &format!("Bearer {}", token), false)
|
||||
.unwrap(),
|
||||
reverse_zone_id: reverse_zone_id.to_owned(),
|
||||
forward_zone_id: forward_zone_id.to_owned(),
|
||||
|
@ -11,11 +11,14 @@ pub struct JsonApi {
|
||||
}
|
||||
|
||||
impl JsonApi {
|
||||
pub fn token(base: &str, token: &str) -> anyhow::Result<Self> {
|
||||
pub fn token(base: &str, token: &str, allow_invalid_certs: bool) -> anyhow::Result<Self> {
|
||||
let mut headers = HeaderMap::new();
|
||||
headers.insert(AUTHORIZATION, token.parse()?);
|
||||
|
||||
let client = Client::builder().default_headers(headers).build()?;
|
||||
let client = Client::builder()
|
||||
.danger_accept_invalid_certs(allow_invalid_certs)
|
||||
.default_headers(headers)
|
||||
.build()?;
|
||||
Ok(Self {
|
||||
client,
|
||||
base: base.parse()?,
|
||||
|
@ -19,7 +19,7 @@ impl MikrotikRouter {
|
||||
STANDARD.encode(format!("{}:{}", username, password))
|
||||
);
|
||||
Self {
|
||||
api: JsonApi::token(url, &auth).unwrap(),
|
||||
api: JsonApi::token(url, &auth, true).unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user