Skip to content

Commit

Permalink
tls
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Apr 24, 2024
1 parent 6df16b7 commit ecb2c05
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
15 changes: 15 additions & 0 deletions nexus/Cargo.lock

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

2 changes: 1 addition & 1 deletion nexus/peer-mysql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ anyhow = "1.0"
async-trait = "0.1"
chrono.workspace = true
futures = { version = "0.3.28", features = ["executor"] }
mysql_async = { version = "0.34", default-features = false, features = ["minimal-rust", "rust_decimal", "chrono"] }
mysql_async = { version = "0.34", default-features = false, features = ["minimal-rust", "rust_decimal", "chrono", "rustls-tls"] }
peer-cursor = { path = "../peer-cursor" }
peer-connections = { path = "../peer-connections" }
pgwire.workspace = true
Expand Down
4 changes: 3 additions & 1 deletion nexus/peer-mysql/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub struct MySqlQueryExecutor {

impl MySqlQueryExecutor {
pub async fn new(peer_name: String, config: &MySqlConfig) -> anyhow::Result<Self> {
// TODO TLS
let mut opts = mysql_async::OptsBuilder::default().prefer_socket(Some(false)); // prefer_socket breaks connecting to StarRocks
if !config.user.is_empty() {
opts = opts.user(Some(config.user.clone()))
Expand All @@ -29,6 +28,9 @@ impl MySqlQueryExecutor {
if !config.database.is_empty() {
opts = opts.db_name(Some(config.database.clone()))
}
if !config.disable_tls {
opts = opts.ssl_opts(mysql_async::SslOpts::default())
}
opts = opts
.compression(mysql_async::Compression::new(config.compression))
.ip_or_hostname(config.host.clone())
Expand Down

0 comments on commit ecb2c05

Please sign in to comment.