Replies: 2 comments 8 replies
-
|
As you already noticed: Diesel-async currently depends on
|
Beta Was this translation helpful? Give feedback.
7 replies
-
|
@oeed Would You be so kind to share Your setup for the Mysql + Tls? I would like to compare it against mine and see if i can do something better. pub async fn establish_connection_tls(database_url: &str) -> Result<Pool<AsyncMysqlConnection>> {
let mgr = AsyncDieselConnectionManager::<AsyncMysqlConnection>::new_with_setup(
database_url,
create_tls_connection,
);
let pool = Pool::builder(mgr)
.max_size(10)
.build()
.context("Error creating pool")?;
Ok(pool)
}
fn create_tls_connection(database_url: &str) -> BoxFuture<ConnectionResult<AsyncMysqlConnection>> {
let fut = async {
let opts = mysql_async::Opts::from_url(database_url).map_err(|e| {
diesel::ConnectionError::BadConnection(format!("Invalid database URL: {}", e))
})?;
let client = mysql_async::Conn::new(opts).await.map_err(|e| {
diesel::ConnectionError::BadConnection(format!("Could not connect to database: {}", e))
})?;
AsyncMysqlConnection::try_from(client).await
};
fut.boxed()
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to avoid having native dependencies (including vendored native-tls) to make compilation and deployment significantly less complex (see this issue). Currently
mysql_asyncdepends onnative-tlsandlibz-sys, with the optional feature of usingrustlsandrust-backendforflate2.native-tlsis enabled onmysql_asyncby disabling default features and then adding the featuredefault-rustls.However, I don't think this is possible to change for consumers of
diesel_asynccurrently. My understand of why this is the case is that features are additive, and thus I cannot tellmysql_asyncto turn off default features in my crate whendiesel_asyncturns them on implicitly. If I'm wrong about this though I'd love to know how!I've been trying the following:
But
native-tlsstill appears incargo tree.There is #64 but that is Postgres specific. I'm not sure if this just due to limits in my understanding of cargo, or if it's not currently possible.
I created a fork which is working with no native depdendencies, which required the following toml changes:
Beta Was this translation helpful? Give feedback.
All reactions