feat(connection): add StarRocks TLS support
This commit is contained in:
1 parent
eaa0d7e735
commit
23b9228f82
6 files changed
+393
-19
No files matched your search
@@ -502,7 +502,7 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
|
||||
let result = match probe_result {
|
||||
Err(e) => Err(e),
|
||||
Ok(()) => match config.db_type {
|
||||
DatabaseType::Mysql if config.needs_bare_mysql() => {
|
||||
DatabaseType::Mysql if config.needs_bare_mysql() && !config.bare_mysql_uses_tls() => {
|
||||
match db::mysql::connect_bare(&url, connect_timeout).await {
|
||||
Ok(pool) => {
|
||||
let _ = pool.disconnect().await;
|
||||
@@ -511,6 +511,15 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
DatabaseType::Mysql if config.needs_bare_mysql() && config.bare_mysql_uses_tls() => {
|
||||
match db::mysql::connect_with_ca_cert(&url, Some(&config.ca_cert_path), connect_timeout).await {
|
||||
Ok(pool) => {
|
||||
let _ = pool.disconnect().await;
|
||||
Ok("Connection successful".to_string())
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
DatabaseType::Mysql => {
|
||||
match db::mysql::connect_with_ca_cert(&url, Some(&config.ca_cert_path), connect_timeout).await {
|
||||
Ok(pool) => {
|
||||
@@ -520,7 +529,7 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
DatabaseType::Doris | DatabaseType::StarRocks | DatabaseType::ManticoreSearch => {
|
||||
DatabaseType::Doris | DatabaseType::ManticoreSearch => {
|
||||
match db::mysql::connect_bare(&url, connect_timeout).await {
|
||||
Ok(pool) => {
|
||||
let _ = pool.disconnect().await;
|
||||
@@ -529,6 +538,20 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
DatabaseType::StarRocks => {
|
||||
let connect = if config.bare_mysql_uses_tls() {
|
||||
db::mysql::connect_with_ca_cert(&url, Some(&config.ca_cert_path), connect_timeout).await
|
||||
} else {
|
||||
db::mysql::connect_bare(&url, connect_timeout).await
|
||||
};
|
||||
match connect {
|
||||
Ok(pool) => {
|
||||
let _ = pool.disconnect().await;
|
||||
Ok("Connection successful".to_string())
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
DatabaseType::Postgres
|
||||
| DatabaseType::Redshift
|
||||
| DatabaseType::Gaussdb
|
||||
|
||||
Reference in new issue
Block a user