fix(mqtt): gate Tauri commands behind feature
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -1967,13 +1967,21 @@ pub fn run() {
|
||||
commands::mq_cmd::mq_raw_request,
|
||||
#[cfg(feature = "mq-admin")]
|
||||
commands::mq_cmd::mq_send_message,
|
||||
#[cfg(feature = "mq-admin")]
|
||||
commands::mqtt_cmd::mqtt_get_broker_info,
|
||||
#[cfg(feature = "mq-admin")]
|
||||
commands::mqtt_cmd::mqtt_subscribe,
|
||||
#[cfg(feature = "mq-admin")]
|
||||
commands::mqtt_cmd::mqtt_unsubscribe,
|
||||
#[cfg(feature = "mq-admin")]
|
||||
commands::mqtt_cmd::mqtt_publish,
|
||||
#[cfg(feature = "mq-admin")]
|
||||
commands::mqtt_cmd::mqtt_list_topics,
|
||||
#[cfg(feature = "mq-admin")]
|
||||
commands::mqtt_cmd::mqtt_get_topic_tree,
|
||||
#[cfg(feature = "mq-admin")]
|
||||
commands::mqtt_cmd::mqtt_get_messages,
|
||||
#[cfg(feature = "mq-admin")]
|
||||
commands::mqtt_cmd::mqtt_clear_messages,
|
||||
commands::history::save_history,
|
||||
commands::history::load_history,
|
||||
|
||||
Reference in New Issue
Block a user