Skip to content

Commit

Permalink
Merge pull request #18 from Multiverse-io/switch_to_native_tls
Browse files Browse the repository at this point in the history
openssl => native_tls
  • Loading branch information
danturn authored Aug 8, 2022
2 parents 4a4b88c + fed4dfc commit e0243b7
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 20 deletions.
136 changes: 124 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ chrono = "0.4"
itertools = "0.10.1"
fake = "2.4"
lazy_static = "1.4.0"
openssl = "0.10.41"
native-tls = "0.2.10"
postgres = "0.19.2"
postgres-openssl = "0.5.0"
postgres-native-tls = "0.5.0"
rand = { version = "0.8", features = ["small_rng"] }
regex = "1"
serde_json = "1.0"
Expand Down
12 changes: 6 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ use crate::opts::{Anonymiser, Opts};
use crate::parsers::strategies::Strategies;
use crate::parsers::strategy_structs::{MissingColumns, SimpleColumn, TransformerOverrides};
use itertools::Itertools;
use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode};
use native_tls::TlsConnector;
use postgres_native_tls::MakeTlsConnector;

use parsers::{db_schema, strategy_file};
use postgres_openssl::MakeTlsConnector;
use structopt::StructOpt;

use mimalloc::MiMalloc;
Expand Down Expand Up @@ -144,10 +145,9 @@ fn missing_to_message(missing: &[SimpleColumn]) -> String {
}

fn strategy_differences(strategies: &Strategies, db_url: String) -> Result<(), MissingColumns> {
let mut builder =
SslConnector::builder(SslMethod::tls()).expect("expected to build tls connector!");
builder.set_verify(SslVerifyMode::PEER);
let connector = MakeTlsConnector::new(builder.build());
let builder = TlsConnector::builder();
let connector =
MakeTlsConnector::new(builder.build().expect("should be able to create builder!"));

let mut client = postgres::Client::connect(&db_url, connector).expect("expected to connect!");
let db_columns = db_schema::parse(&mut client);
Expand Down

0 comments on commit e0243b7

Please sign in to comment.