Skip to content

Commit d86bf4f

Browse files
committed
Enable the example in CI + add some comment about difference to sslmode
1 parent 3eb7f62 commit d86bf4f

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ jobs:
115115

116116
- name: Test diesel_async
117117
run: cargo +${{ matrix.rust }} test --manifest-path Cargo.toml --no-default-features --features "${{ matrix.backend }} deadpool bb8 mobc"
118+
- name: Run examples
119+
if: matrix.backend == 'postgres'
120+
run: cargo +${{ matrix.rust }} check --manifest-path examples/postgres/pooled-with-rustls
118121

119122
rustfmt_and_clippy:
120123
name: Check rustfmt style && run clippy

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,9 @@ rustdoc-args = ["--cfg", "doc_cfg"]
5151

5252
[patch.crates-io]
5353
diesel = { git = "https://github.com/diesel-rs/diesel", rev = "b878fed" }
54+
55+
[workspace]
56+
members = [
57+
".",
58+
"examples/postgres/pooled-with-rustls"
59+
]

examples/postgres/pooled-with-rustls/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
diesel = { version = "2.0.3", default-features = false, features = ["postgres"] }
10-
diesel-async = { version = "0.2.0", features = ["bb8", "postgres"] }
9+
diesel = { version = "2.0.2", default-features = false, features = ["postgres"] }
10+
diesel-async = { version = "0.2.0", path = "../../../", features = ["bb8", "postgres"] }
1111
futures-util = "0.3.21"
1212
rustls = "0.20.8"
1313
rustls-native-certs = "0.6.2"

examples/postgres/pooled-with-rustls/src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1717
establish_connection,
1818
);
1919
// From that connection we can then create a pool, here given with some example settings.
20+
//
21+
// This creates a TLS configuration that's equivalent to `libpq'` `sslmode=verify-full`, which
22+
// means this will check whether the provided certificate is valid for the given database host.
23+
//
24+
// `libpq` does not perform these checks by default (https://www.postgresql.org/docs/current/libpq-connect.html)
25+
// If you hit a TLS error while conneting to the database double check your certificates
2026
let pool = Pool::builder()
2127
.max_size(10)
2228
.min_idle(Some(5))

0 commit comments

Comments
 (0)