File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIBozCCAUqgAwIBAgIJAMDLUd0ypWHdMAoGCCqGSM49BAMDMCUxIzAhBgNVBAMM
3
+ GnJqamxwMmxnbWJjanZvamV4YjN3NndsNTVlMB4XDTI0MDYwNTA2MjcyOVoXDTQ0
4
+ MDUzMTA2MjcyOVowJTEjMCEGA1UEAwwacmpqbHAybGdtYmNqdm9qZXhiM3c2d2w1
5
+ NWUwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS4J3uDAfsWOQFD6XAwpPWOvviY
6
+ kCPqyJ37OGMOhA70zvQKOnxTmrKu2p7lsyVrnbCtD4Ve11CouI4iDPeVmK/wo2Mw
7
+ YTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUy5m8
8
+ qXuAIReA7KFV1fKaHLPZo14wHwYDVR0jBBgwFoAUy5m8qXuAIReA7KFV1fKaHLPZ
9
+ o14wCgYIKoZIzj0EAwMDRwAwRAIgQfpsO+B96Xse+ushnl+0Abx2tx0F5ac+K0L/
10
+ x4uyKP4CIBaCSz+Oa/rG30W2F0VVtJN8guKFvnCMy7Gg/XCGGx8l
11
+ -----END CERTIFICATE-----
Original file line number Diff line number Diff line change 1
- //! Certificates from <https://letsencrypt.org/certificates/>.
2
-
1
+ /// Certificate from <https://letsencrypt.org/certificates/>.
3
2
pub const ISRG_ROOT_X1 : & [ u8 ] = include_bytes ! ( "./isrg-root-x1.pem" ) ;
3
+
4
+ /// Certificate from <https://letsencrypt.org/certificates/>.
4
5
pub const ISRG_ROOT_X2 : & [ u8 ] = include_bytes ! ( "./isrg-root-x2.pem" ) ;
6
+
7
+ /// crates.io team certificate from <https://crunchybridge.com/>.
8
+ pub const CRUNCHY : & [ u8 ] = include_bytes ! ( "./crunchy.pem" ) ;
Original file line number Diff line number Diff line change
1
+ use crate :: certs:: CRUNCHY ;
1
2
use diesel:: { Connection , ConnectionResult , PgConnection , QueryResult } ;
2
3
use diesel_async:: pooled_connection:: deadpool:: { Hook , HookError } ;
3
4
use diesel_async:: pooled_connection:: ManagerConfig ;
4
5
use diesel_async:: { AsyncPgConnection , RunQueryDsl } ;
5
- use native_tls:: TlsConnector ;
6
+ use native_tls:: { Certificate , TlsConnector } ;
6
7
use postgres_native_tls:: MakeTlsConnector ;
7
8
use secrecy:: ExposeSecret ;
8
9
use std:: time:: Duration ;
@@ -60,7 +61,10 @@ pub fn make_manager_config() -> ManagerConfig<AsyncPgConnection> {
60
61
async fn establish_async_connection ( url : & str ) -> ConnectionResult < AsyncPgConnection > {
61
62
use diesel:: ConnectionError :: BadConnection ;
62
63
64
+ let cert = Certificate :: from_pem ( CRUNCHY ) . map_err ( |err| BadConnection ( err. to_string ( ) ) ) ?;
65
+
63
66
let connector = TlsConnector :: builder ( )
67
+ . add_root_certificate ( cert)
64
68
// The TLS certificate of our current database server has a long validity
65
69
// period and OSX rejects such certificates as "not trusted". If you run
66
70
// into "Certificate was not trusted" errors during local development,
You can’t perform that action at this time.
0 commit comments