Skip to content

Commit cb4c3ef

Browse files
committed
feat: enable postgres ssl
1 parent ac7ceb8 commit cb4c3ef

File tree

3 files changed

+143
-6
lines changed

3 files changed

+143
-6
lines changed

Cargo.lock

Lines changed: 136 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ duckdb = { version = "1.3.2", features = ["bundled"] }
2828
libsql = { version = "0.9.19", features = ["remote"] }
2929
tiberius = { version = "0.12.3", default-features = false, features = ["rustls", "tds73", "tokio", "tokio-util"] }
3030
tokio-util = "0.7.15"
31+
native-tls = "0.2.14"
32+
postgres-native-tls = "0.5.1"
3133

3234
[profile.release]
3335
strip = true

src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ mod libsql {
13911391
mod postgres {
13921392
use std::{sync::Arc, time::Duration};
13931393

1394-
use tokio_postgres::{Client, NoTls};
1394+
use tokio_postgres::Client;
13951395

13961396
use crate::{
13971397
Database, ROWS_PER_PAGE, helpers,
@@ -1411,7 +1411,10 @@ mod postgres {
14111411
schema: String,
14121412
query_timeout: Duration,
14131413
) -> color_eyre::Result<Self> {
1414-
let (client, connection) = tokio_postgres::connect(&url, NoTls).await?;
1414+
let connector = native_tls::TlsConnector::builder().build()?;
1415+
let connector = postgres_native_tls::MakeTlsConnector::new(connector);
1416+
1417+
let (client, connection) = tokio_postgres::connect(&url, connector).await?;
14151418

14161419
// The connection object performs the actual communication with the database,
14171420
// so spawn it off to run on its own.

0 commit comments

Comments
 (0)