mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-08 11:11:37 +00:00
Fixing issue when local has no openssl certs.
This commit is contained in:
parent
53a70d47c5
commit
8db37baf93
3 changed files with 15 additions and 3 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1880,6 +1880,7 @@ dependencies = [
|
||||||
"lemmy_websocket",
|
"lemmy_websocket",
|
||||||
"log",
|
"log",
|
||||||
"openssl",
|
"openssl",
|
||||||
|
"openssl-probe",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
|
@ -63,6 +63,7 @@ activitystreams = "0.7.0-alpha.11"
|
||||||
actix-rt = { version = "2.2.0", default-features = false }
|
actix-rt = { version = "2.2.0", default-features = false }
|
||||||
serde_json = { version = "1.0.66", features = ["preserve_order"] }
|
serde_json = { version = "1.0.66", features = ["preserve_order"] }
|
||||||
clokwerk = "0.3.5"
|
clokwerk = "0.3.5"
|
||||||
|
openssl-probe = "0.1.2"
|
||||||
|
|
||||||
[dev-dependencies.cargo-husky]
|
[dev-dependencies.cargo-husky]
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
|
|
16
src/main.rs
16
src/main.rs
|
@ -20,7 +20,8 @@ use lemmy_utils::{
|
||||||
LemmyError,
|
LemmyError,
|
||||||
};
|
};
|
||||||
use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
|
use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
|
||||||
use reqwest::Client;
|
use log::warn;
|
||||||
|
use reqwest::{Client, ClientBuilder};
|
||||||
use std::{sync::Arc, thread};
|
use std::{sync::Arc, thread};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
|
@ -67,12 +68,21 @@ async fn main() -> Result<(), LemmyError> {
|
||||||
|
|
||||||
let activity_queue = create_activity_queue();
|
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(
|
let chat_server = ChatServer::startup(
|
||||||
pool.clone(),
|
pool.clone(),
|
||||||
rate_limiter.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(c, i, o, d)),
|
||||||
|c, i, o, d| Box::pin(match_websocket_operation_crud(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(),
|
activity_queue.clone(),
|
||||||
)
|
)
|
||||||
.start();
|
.start();
|
||||||
|
@ -82,7 +92,7 @@ async fn main() -> Result<(), LemmyError> {
|
||||||
let context = LemmyContext::create(
|
let context = LemmyContext::create(
|
||||||
pool.clone(),
|
pool.clone(),
|
||||||
chat_server.to_owned(),
|
chat_server.to_owned(),
|
||||||
Client::default(),
|
client.clone(),
|
||||||
activity_queue.to_owned(),
|
activity_queue.to_owned(),
|
||||||
);
|
);
|
||||||
let rate_limiter = rate_limiter.clone();
|
let rate_limiter = rate_limiter.clone();
|
||||||
|
|
Loading…
Reference in a new issue