Fixing issue when local has no openssl certs.

This commit is contained in:
Dessalines 2021-08-17 19:14:52 -04:00
parent 53a70d47c5
commit 8db37baf93
3 changed files with 15 additions and 3 deletions

1
Cargo.lock generated
View file

@ -1880,6 +1880,7 @@ dependencies = [
"lemmy_websocket",
"log",
"openssl",
"openssl-probe",
"reqwest",
"serde",
"serde_json",

View file

@ -63,6 +63,7 @@ activitystreams = "0.7.0-alpha.11"
actix-rt = { version = "2.2.0", default-features = false }
serde_json = { version = "1.0.66", features = ["preserve_order"] }
clokwerk = "0.3.5"
openssl-probe = "0.1.2"
[dev-dependencies.cargo-husky]
version = "1.5.0"

View file

@ -20,7 +20,8 @@ use lemmy_utils::{
LemmyError,
};
use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
use reqwest::Client;
use log::warn;
use reqwest::{Client, ClientBuilder};
use std::{sync::Arc, thread};
use tokio::sync::Mutex;
@ -67,12 +68,21 @@ async fn main() -> Result<(), LemmyError> {
let activity_queue = create_activity_queue();
let client = if !openssl_probe::has_ssl_cert_env_vars() {
warn!("No OpenSSL certs found, accepting invalid certs.");
ClientBuilder::new()
.danger_accept_invalid_certs(true)
.build()?
} else {
Client::default()
};
let chat_server = ChatServer::startup(
pool.clone(),
rate_limiter.clone(),
|c, i, o, d| Box::pin(match_websocket_operation(c, i, o, d)),
|c, i, o, d| Box::pin(match_websocket_operation_crud(c, i, o, d)),
Client::default(),
client.clone(),
activity_queue.clone(),
)
.start();
@ -82,7 +92,7 @@ async fn main() -> Result<(), LemmyError> {
let context = LemmyContext::create(
pool.clone(),
chat_server.to_owned(),
Client::default(),
client.clone(),
activity_queue.to_owned(),
);
let rate_limiter = rate_limiter.clone();