fix(mqtt): gate Tauri commands behind feature

This commit is contained in:
t8y2 committed 2026-08-04 19:56:19 +08:00
1 parent 8cfe380784
commit 8d03d284d9
3 files changed
+19

No files matched your search

+10
View File
@@ -1098,12 +1098,17 @@ async fn test_connection_with_info_inner(
Err("Message queue admin support is not compiled in this build. Rebuild with the 'mq-admin' feature."
.to_string())
}
#[cfg(feature = "mq-admin")]
DatabaseType::Mqtt => {
let mqtt_config = dbx_core::mqtt::types::MqttConnectionConfig::from_connection(&config)?;
let client = dbx_core::mqtt::client::MqttClient::connect(mqtt_config).await?;
client.disconnect().await;
Ok("Connection successful".to_string())
}
#[cfg(not(feature = "mq-admin"))]
DatabaseType::Mqtt => {
Err("MQTT support is not compiled in this build. Rebuild with the 'mq-admin' feature.".to_string())
}
db_type if database_capabilities::is_agent_type(&db_type) => {
match test_agent_connection(state, &config, &host, port).await {
Ok(details) => {
@@ -1455,11 +1460,16 @@ pub async fn connect_db(
state.external_driver_pool("jdbc", &jdbc_config).await?
}
DatabaseType::Jdbc => state.external_driver_pool("jdbc", &db_config).await?,
#[cfg(feature = "mq-admin")]
DatabaseType::Mqtt => {
let mqtt_config = dbx_core::mqtt::types::MqttConnectionConfig::from_connection(&db_config)?;
let client = dbx_core::mqtt::client::MqttClient::connect(mqtt_config).await?;
PoolKind::Mqtt(client)
}
#[cfg(not(feature = "mq-admin"))]
DatabaseType::Mqtt => {
return Err("MQTT support is not compiled in this build. Rebuild with the 'mq-admin' feature.".to_string());
}
db_type => return Err(format!("Unsupported database type: {db_type:?}")),
};
+1
View File
@@ -26,6 +26,7 @@ pub mod mcp_bridge;
pub mod mongo_cmd;
#[cfg(feature = "mq-admin")]
pub mod mq_cmd;
#[cfg(feature = "mq-admin")]
pub mod mqtt_cmd;
pub mod nacos_cmd;
pub mod plugins;