feat(consul): add Consul full-stack workbench
This commit is contained in:
148 files changed
+24032
-378
No files matched your search
@@ -1092,6 +1092,27 @@ async fn test_connection_with_info_inner(
|
||||
adapter.test_connection().await?;
|
||||
Ok("Connection successful".to_string())
|
||||
}
|
||||
DatabaseType::Consul => {
|
||||
let mut consul_config = dbx_core::consul::ConsulConfig::from_connection(&config)?;
|
||||
let validate_agent_target = consul_config.agent_target.is_some();
|
||||
let original_host = consul_config.base_url.host_str().unwrap_or_default();
|
||||
let original_port = consul_config.base_url.port_or_known_default().unwrap_or(config.port);
|
||||
if host != original_host || port != original_port {
|
||||
consul_config = consul_config.with_connect_override(&host, port);
|
||||
}
|
||||
let client = dbx_core::consul::ConsulClient::new(consul_config).await?;
|
||||
client.probe().await?;
|
||||
let identity = if validate_agent_target {
|
||||
Some(client.validate_configured_agent_target().await?)
|
||||
} else {
|
||||
client.agent_self().await.ok()
|
||||
};
|
||||
Ok(identity
|
||||
.map(|identity| format!("Connection successful (Agent: {} at {})", identity.node, identity.address))
|
||||
.unwrap_or_else(|| {
|
||||
"Connection successful (Agent identity unavailable; Agent writes disabled)".to_string()
|
||||
}))
|
||||
}
|
||||
#[cfg(feature = "mq-admin")]
|
||||
DatabaseType::MessageQueue => {
|
||||
// Probe with a transient adapter so Test Connection never retains/replaces
|
||||
@@ -1435,6 +1456,17 @@ pub async fn connect_db(
|
||||
adapter.test_connection().await?;
|
||||
PoolKind::Nacos
|
||||
}
|
||||
DatabaseType::Consul => {
|
||||
let mut consul_config = dbx_core::consul::ConsulConfig::from_connection(&db_config)?;
|
||||
let original_host = consul_config.base_url.host_str().unwrap_or_default();
|
||||
let original_port = consul_config.base_url.port_or_known_default().unwrap_or(db_config.port);
|
||||
if host != original_host || port != original_port {
|
||||
consul_config = consul_config.with_connect_override(&host, port);
|
||||
}
|
||||
let client = dbx_core::consul::ConsulClient::new(consul_config).await?;
|
||||
client.probe().await?;
|
||||
PoolKind::Consul(client)
|
||||
}
|
||||
#[cfg(feature = "mq-admin")]
|
||||
DatabaseType::MessageQueue => {
|
||||
let mqc = state.mq_admin_config_for_connection(&id, &config).await?;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -7,6 +7,7 @@ pub mod config_cmd;
|
||||
pub mod connection;
|
||||
#[allow(dead_code, unused_imports)]
|
||||
mod connection_secrets;
|
||||
pub mod consul_cmd;
|
||||
pub mod csv_export;
|
||||
pub mod data_compare;
|
||||
pub mod database_export;
|
||||
|
||||
@@ -1818,6 +1818,109 @@ pub fn run() {
|
||||
commands::zookeeper_cmd::zookeeper_get,
|
||||
commands::zookeeper_cmd::zookeeper_put,
|
||||
commands::zookeeper_cmd::zookeeper_delete,
|
||||
commands::consul_cmd::consul_capabilities,
|
||||
commands::consul_cmd::consul_txn,
|
||||
commands::consul_cmd::consul_rename_key,
|
||||
commands::consul_cmd::consul_blocking_query,
|
||||
commands::consul_cmd::consul_domain_watch,
|
||||
commands::consul_cmd::consul_cancel_blocking,
|
||||
commands::consul_cmd::consul_watch_start,
|
||||
commands::consul_cmd::consul_list_prefix,
|
||||
commands::consul_cmd::consul_list_recursive,
|
||||
commands::consul_cmd::consul_search,
|
||||
commands::consul_cmd::consul_search_progress,
|
||||
commands::consul_cmd::consul_cancel_search,
|
||||
commands::consul_cmd::consul_export_bundle,
|
||||
commands::consul_cmd::consul_import_preview,
|
||||
commands::consul_cmd::consul_import_execute,
|
||||
commands::consul_cmd::consul_delete_prefix_preview,
|
||||
commands::consul_cmd::consul_delete_prefix_execute,
|
||||
commands::consul_cmd::consul_get,
|
||||
commands::consul_cmd::consul_put,
|
||||
commands::consul_cmd::consul_delete,
|
||||
commands::consul_cmd::consul_prepared_query_list,
|
||||
commands::consul_cmd::consul_prepared_query_read,
|
||||
commands::consul_cmd::consul_prepared_query_create,
|
||||
commands::consul_cmd::consul_prepared_query_update,
|
||||
commands::consul_cmd::consul_prepared_query_delete,
|
||||
commands::consul_cmd::consul_prepared_query_execute,
|
||||
commands::consul_cmd::consul_prepared_query_explain,
|
||||
commands::consul_cmd::consul_event_list,
|
||||
commands::consul_cmd::consul_event_fire,
|
||||
commands::consul_cmd::consul_coordinate_nodes,
|
||||
commands::consul_cmd::consul_operator_read,
|
||||
commands::consul_cmd::consul_snapshot_generate,
|
||||
commands::consul_cmd::consul_snapshot_restore,
|
||||
commands::consul_cmd::consul_autopilot_update,
|
||||
commands::consul_cmd::consul_raft_transfer,
|
||||
commands::consul_cmd::consul_raft_remove,
|
||||
commands::consul_cmd::consul_keyring_write,
|
||||
commands::consul_cmd::consul_license_write,
|
||||
commands::consul_cmd::consul_status_leader,
|
||||
commands::consul_cmd::consul_status_peers,
|
||||
commands::consul_cmd::consul_agent_self,
|
||||
commands::consul_cmd::consul_agent_members,
|
||||
commands::consul_cmd::consul_agent_metrics,
|
||||
commands::consul_cmd::consul_catalog_datacenters,
|
||||
commands::consul_cmd::consul_catalog_nodes,
|
||||
commands::consul_cmd::consul_catalog_services,
|
||||
commands::consul_cmd::consul_catalog_service_nodes,
|
||||
commands::consul_cmd::consul_catalog_node_services,
|
||||
commands::consul_cmd::consul_health_node,
|
||||
commands::consul_cmd::consul_health_checks,
|
||||
commands::consul_cmd::consul_health_service,
|
||||
commands::consul_cmd::consul_health_state,
|
||||
commands::consul_cmd::consul_agent_services,
|
||||
commands::consul_cmd::consul_agent_service,
|
||||
commands::consul_cmd::consul_agent_checks,
|
||||
commands::consul_cmd::consul_agent_register_service,
|
||||
commands::consul_cmd::consul_agent_deregister_service,
|
||||
commands::consul_cmd::consul_agent_service_maintenance,
|
||||
commands::consul_cmd::consul_agent_register_check,
|
||||
commands::consul_cmd::consul_agent_deregister_check,
|
||||
commands::consul_cmd::consul_agent_update_ttl,
|
||||
commands::consul_cmd::consul_sessions,
|
||||
commands::consul_cmd::consul_node_sessions,
|
||||
commands::consul_cmd::consul_session,
|
||||
commands::consul_cmd::consul_session_keys,
|
||||
commands::consul_cmd::consul_session_destroy_impact,
|
||||
commands::consul_cmd::consul_create_session,
|
||||
commands::consul_cmd::consul_renew_session,
|
||||
commands::consul_cmd::consul_destroy_session,
|
||||
commands::consul_cmd::consul_acquire_lock,
|
||||
commands::consul_cmd::consul_release_lock,
|
||||
commands::consul_cmd::consul_acl_list,
|
||||
commands::consul_cmd::consul_acl_token_self,
|
||||
commands::consul_cmd::consul_acl_token_clone,
|
||||
commands::consul_cmd::consul_acl_get,
|
||||
commands::consul_cmd::consul_acl_apply,
|
||||
commands::consul_cmd::consul_acl_references,
|
||||
commands::consul_cmd::consul_acl_delete,
|
||||
commands::consul_cmd::consul_enterprise_list,
|
||||
commands::consul_cmd::consul_enterprise_get,
|
||||
commands::consul_cmd::consul_enterprise_apply,
|
||||
commands::consul_cmd::consul_enterprise_impact,
|
||||
commands::consul_cmd::consul_enterprise_delete,
|
||||
commands::consul_cmd::consul_mesh_config_list,
|
||||
commands::consul_cmd::consul_mesh_config_get,
|
||||
commands::consul_cmd::consul_mesh_config_apply,
|
||||
commands::consul_cmd::consul_mesh_config_delete,
|
||||
commands::consul_cmd::consul_mesh_intentions_list,
|
||||
commands::consul_cmd::consul_mesh_intention_get,
|
||||
commands::consul_cmd::consul_mesh_intention_get_exact,
|
||||
commands::consul_cmd::consul_mesh_intention_upsert,
|
||||
commands::consul_cmd::consul_mesh_intention_delete,
|
||||
commands::consul_cmd::consul_mesh_intention_delete_exact,
|
||||
commands::consul_cmd::consul_mesh_intention_match,
|
||||
commands::consul_cmd::consul_mesh_intention_check,
|
||||
commands::consul_cmd::consul_mesh_discovery_chain,
|
||||
commands::consul_cmd::consul_mesh_peering_list,
|
||||
commands::consul_cmd::consul_mesh_peering_get,
|
||||
commands::consul_cmd::consul_mesh_peering_generate_token,
|
||||
commands::consul_cmd::consul_mesh_peering_establish,
|
||||
commands::consul_cmd::consul_mesh_peering_delete,
|
||||
commands::consul_cmd::consul_mesh_exported_services_list,
|
||||
commands::consul_cmd::consul_mesh_exported_services_apply,
|
||||
commands::nacos_cmd::nacos_test_connection,
|
||||
commands::nacos_cmd::nacos_list_namespaces,
|
||||
commands::nacos_cmd::nacos_create_namespace,
|
||||
|
||||
Reference in new issue
Block a user