Fix tls pool (#4910)

* Cargo: add rustls as a dependency

* install tls provider in main

* Cargo: re-define rustls dependency
This commit is contained in:
Darren M 2024-07-21 19:33:42 -07:00 committed by GitHub
parent a08642f813
commit 3d80ac2ebb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View File

@ -203,6 +203,7 @@ opentelemetry = { workspace = true, optional = true }
console-subscriber = { version = "0.3.0", optional = true }
opentelemetry-otlp = { version = "0.12.0", optional = true }
pict-rs = { version = "0.5.15", optional = true }
rustls = { workspace = true }
tokio.workspace = true
actix-cors = "0.7.0"
futures-util = { workspace = true }

View File

@ -327,10 +327,6 @@ fn establish_connection(config: &str) -> BoxFuture<ConnectionResult<AsyncPgConne
let fut = async {
// We only support TLS with sslmode=require currently
let mut conn = if config.contains("sslmode=require") {
rustls::crypto::ring::default_provider()
.install_default()
.expect("Failed to install rustls crypto provider");
let rustls_config = DangerousClientConfigBuilder {
cfg: ClientConfig::builder(),
}

View File

@ -2,11 +2,17 @@ use clap::Parser;
use lemmy_server::{init_logging, start_lemmy_server, CmdArgs};
use lemmy_utils::{error::LemmyResult, settings::SETTINGS};
pub extern crate rustls;
#[tokio::main]
pub async fn main() -> LemmyResult<()> {
init_logging(&SETTINGS.opentelemetry_url)?;
let args = CmdArgs::parse();
rustls::crypto::ring::default_provider()
.install_default()
.expect("Failed to install rustls crypto provider");
#[cfg(not(feature = "embed-pictrs"))]
start_lemmy_server(args).await?;
#[cfg(feature = "embed-pictrs")]