feat: add InfluxDB support (#980)
This commit is contained in:
@@ -426,6 +426,20 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
|
||||
.await
|
||||
.map(|_| "Connection successful".to_string())
|
||||
}
|
||||
DatabaseType::InfluxDb => {
|
||||
let username = if config.username.is_empty() { None } else { Some(config.username.clone()) };
|
||||
let password = if config.password.is_empty() { None } else { Some(config.password.clone()) };
|
||||
let client = db::influxdb_driver::InfluxdbClient::new_with_ca_cert(
|
||||
&url,
|
||||
username,
|
||||
password,
|
||||
Some(&config.ca_cert_path),
|
||||
connect_timeout,
|
||||
)?;
|
||||
db::influxdb_driver::test_connection(&client, connect_timeout)
|
||||
.await
|
||||
.map(|_| "Connection successful".to_string())
|
||||
}
|
||||
db_type if database_capabilities::is_agent_type(&db_type) => {
|
||||
test_agent_connection(state.inner(), &config, &host, port).await
|
||||
}
|
||||
@@ -617,6 +631,19 @@ pub async fn connect_db(state: State<'_, Arc<AppState>>, config: ConnectionConfi
|
||||
db::turso_driver::test_connection(&client, connect_timeout).await?;
|
||||
PoolKind::Turso(client)
|
||||
}
|
||||
DatabaseType::InfluxDb => {
|
||||
let username = if db_config.username.is_empty() { None } else { Some(db_config.username.clone()) };
|
||||
let password = if db_config.password.is_empty() { None } else { Some(db_config.password.clone()) };
|
||||
let client = db::influxdb_driver::InfluxdbClient::new_with_ca_cert(
|
||||
&url,
|
||||
username,
|
||||
password,
|
||||
Some(&db_config.ca_cert_path),
|
||||
connect_timeout,
|
||||
)?;
|
||||
db::influxdb_driver::test_connection(&client, connect_timeout).await?;
|
||||
PoolKind::InfluxDb(client)
|
||||
}
|
||||
db_type if database_capabilities::is_agent_type(&db_type) => {
|
||||
connect_agent_pool(state.inner(), &db_config, &host, port).await?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user