mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-29 00:42:19 +00:00
parent
7972dd0fcf
commit
d95df3a46f
|
@ -99,7 +99,7 @@ activitypub_federation = { version = "0.5.0-beta.5", default-features = false, f
|
||||||
] }
|
] }
|
||||||
diesel = "2.1.4"
|
diesel = "2.1.4"
|
||||||
diesel_migrations = "2.1.0"
|
diesel_migrations = "2.1.0"
|
||||||
diesel-async = "0.3.2"
|
diesel-async = "0.4.1"
|
||||||
serde = { version = "1.0.193", features = ["derive"] }
|
serde = { version = "1.0.193", features = ["derive"] }
|
||||||
serde_with = "3.4.0"
|
serde_with = "3.4.0"
|
||||||
actix-web = { version = "4.4.0", default-features = false, features = [
|
actix-web = { version = "4.4.0", default-features = false, features = [
|
||||||
|
|
|
@ -24,6 +24,7 @@ use diesel_async::{
|
||||||
pooled_connection::{
|
pooled_connection::{
|
||||||
deadpool::{Object as PooledConnection, Pool},
|
deadpool::{Object as PooledConnection, Pool},
|
||||||
AsyncDieselConnectionManager,
|
AsyncDieselConnectionManager,
|
||||||
|
ManagerConfig,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use diesel_migrations::EmbeddedMigrations;
|
use diesel_migrations::EmbeddedMigrations;
|
||||||
|
@ -291,7 +292,9 @@ pub async fn build_db_pool() -> Result<ActualDbPool, LemmyError> {
|
||||||
let manager = if tls_enabled {
|
let manager = if tls_enabled {
|
||||||
// diesel-async does not support any TLS connections out of the box, so we need to manually
|
// diesel-async does not support any TLS connections out of the box, so we need to manually
|
||||||
// provide a setup function which handles creating the connection
|
// provide a setup function which handles creating the connection
|
||||||
AsyncDieselConnectionManager::<AsyncPgConnection>::new_with_setup(&db_url, establish_connection)
|
let mut config = ManagerConfig::default();
|
||||||
|
config.custom_setup = Box::new(establish_connection);
|
||||||
|
AsyncDieselConnectionManager::<AsyncPgConnection>::new_with_config(&db_url, config)
|
||||||
} else {
|
} else {
|
||||||
AsyncDieselConnectionManager::<AsyncPgConnection>::new(&db_url)
|
AsyncDieselConnectionManager::<AsyncPgConnection>::new(&db_url)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue