From e236d503996631fddec125591f4ac9d05a0be663 Mon Sep 17 00:00:00 2001 From: James Rhodes Date: Fri, 7 Jun 2024 11:16:01 +0100 Subject: [PATCH] Expose bridge connection feature flag to match backoff parameters Signed-off-by: James Rhodes --- .../src/tedge_config_cli/tedge_config.rs | 18 ------------------ .../core/tedge/src/cli/config/commands/list.rs | 3 +-- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/crates/common/tedge_config/src/tedge_config_cli/tedge_config.rs b/crates/common/tedge_config/src/tedge_config_cli/tedge_config.rs index c16ebd8076a..04bcaec5a02 100644 --- a/crates/common/tedge_config/src/tedge_config_cli/tedge_config.rs +++ b/crates/common/tedge_config/src/tedge_config_cli/tedge_config.rs @@ -465,7 +465,6 @@ define_tedge_config! { /// if this is set to "c8y", then messages published to `c8y/s/us` will be /// forwarded by to Cumulocity on the `s/us` topic #[tedge_config(example = "c8y", default(function = "c8y_topic_prefix"))] - #[doku(skip)] // Hide the configuration in `tedge config list --doc` topic_prefix: TopicPrefix, }, @@ -661,7 +660,6 @@ define_tedge_config! { bridge: { #[tedge_config(default(value = false))] - #[doku(skip)] // Hide the configuration in `tedge config list --doc` built_in: bool, reconnect_policy: { @@ -868,22 +866,6 @@ fn c8y_topic_prefix() -> TopicPrefix { TopicPrefix::try_new("c8y").unwrap() } -impl ReadableKey { - // This is designed to be a simple way of controlling whether values appear in the output of - // `tedge config list`. Ideally this would be integrated into [define_tedge_config], see - // https://github.com/thin-edge/thin-edge.io/issues/2767 for more detail on that. - // Currently this accompanies `#[doku(skip)]` on the relevant configurations, which hides - // them in `tedge config list --doc`. The configurations are hidden to avoid unfinished - // features from being discovered. - pub fn is_printable_value(self, value: &str) -> bool { - match self { - Self::MqttBridgeBuiltIn => value != "false", - Self::C8yBridgeTopicPrefix => value != "c8y", - _ => true, - } - } -} - #[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Deserialize, serde::Serialize)] #[serde(try_from = "Cow<'_, str>", into = "Arc")] /// A valid MQTT topic prefix, used to customise the c8y/ topic prefix diff --git a/crates/core/tedge/src/cli/config/commands/list.rs b/crates/core/tedge/src/cli/config/commands/list.rs index 255a491ad5e..2b38e50eeb5 100644 --- a/crates/core/tedge/src/cli/config/commands/list.rs +++ b/crates/core/tedge/src/cli/config/commands/list.rs @@ -33,10 +33,9 @@ fn print_config_list(config: &TEdgeConfig, all: bool) -> Result<(), ConfigError> let mut keys_without_values = Vec::new(); for config_key in ReadableKey::iter() { match config.read_string(config_key).ok() { - Some(value) if config_key.is_printable_value(&value) => { + Some(value) => { println!("{}={}", config_key, value); } - Some(_) => {} None => { keys_without_values.push(config_key); }