fix(mqtt): gate Tauri commands behind feature
This commit is contained in:
3 files changed
+19
No files matched your search
@@ -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:?}")),
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user