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:
parent
a08642f813
commit
3d80ac2ebb
3 changed files with 7 additions and 4 deletions
|
@ -203,6 +203,7 @@ opentelemetry = { workspace = true, optional = true }
|
||||||
console-subscriber = { version = "0.3.0", optional = true }
|
console-subscriber = { version = "0.3.0", optional = true }
|
||||||
opentelemetry-otlp = { version = "0.12.0", optional = true }
|
opentelemetry-otlp = { version = "0.12.0", optional = true }
|
||||||
pict-rs = { version = "0.5.15", optional = true }
|
pict-rs = { version = "0.5.15", optional = true }
|
||||||
|
rustls = { workspace = true }
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
actix-cors = "0.7.0"
|
actix-cors = "0.7.0"
|
||||||
futures-util = { workspace = true }
|
futures-util = { workspace = true }
|
||||||
|
|
|
@ -327,10 +327,6 @@ fn establish_connection(config: &str) -> BoxFuture<ConnectionResult<AsyncPgConne
|
||||||
let fut = async {
|
let fut = async {
|
||||||
// We only support TLS with sslmode=require currently
|
// We only support TLS with sslmode=require currently
|
||||||
let mut conn = if config.contains("sslmode=require") {
|
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 {
|
let rustls_config = DangerousClientConfigBuilder {
|
||||||
cfg: ClientConfig::builder(),
|
cfg: ClientConfig::builder(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,17 @@ use clap::Parser;
|
||||||
use lemmy_server::{init_logging, start_lemmy_server, CmdArgs};
|
use lemmy_server::{init_logging, start_lemmy_server, CmdArgs};
|
||||||
use lemmy_utils::{error::LemmyResult, settings::SETTINGS};
|
use lemmy_utils::{error::LemmyResult, settings::SETTINGS};
|
||||||
|
|
||||||
|
pub extern crate rustls;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
pub async fn main() -> LemmyResult<()> {
|
pub async fn main() -> LemmyResult<()> {
|
||||||
init_logging(&SETTINGS.opentelemetry_url)?;
|
init_logging(&SETTINGS.opentelemetry_url)?;
|
||||||
let args = CmdArgs::parse();
|
let args = CmdArgs::parse();
|
||||||
|
|
||||||
|
rustls::crypto::ring::default_provider()
|
||||||
|
.install_default()
|
||||||
|
.expect("Failed to install rustls crypto provider");
|
||||||
|
|
||||||
#[cfg(not(feature = "embed-pictrs"))]
|
#[cfg(not(feature = "embed-pictrs"))]
|
||||||
start_lemmy_server(args).await?;
|
start_lemmy_server(args).await?;
|
||||||
#[cfg(feature = "embed-pictrs")]
|
#[cfg(feature = "embed-pictrs")]
|
||||||
|
|
Loading…
Reference in a new issue