Skip to content

Commit a44c828

Browse files
committed
Don't reexport inner tedge_config::*
tedge_config! macro creates a lot of structs that clutter item list when reexported. Instead reexport only top-level struct as that what's most commonly used. Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
1 parent 9136516 commit a44c828

File tree

48 files changed

+92
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+92
-86
lines changed

crates/common/tedge_config/src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ mod sudo;
22
pub use sudo::SudoCommandBuilder;
33
pub mod cli;
44
mod system_toml;
5-
pub use self::system_toml::*;
5+
pub use system_toml::*;
66

77
pub mod tedge_toml;
8-
pub use self::tedge_toml::error::*;
9-
pub use self::tedge_toml::tedge_config::*;
10-
pub use self::tedge_toml::tedge_config_location::*;
8+
pub use tedge_toml::error::*;
119
pub use tedge_toml::models;
10+
pub use tedge_toml::tedge_config::TEdgeConfig;
11+
pub use tedge_toml::tedge_config::TEdgeConfigDto;
12+
pub use tedge_toml::tedge_config::TEdgeConfigReader;
13+
pub use tedge_toml::tedge_config_location::*;
1214

1315
pub use camino::Utf8Path as Path;
1416
pub use camino::Utf8PathBuf as PathBuf;

crates/common/tedge_config/src/tedge_toml/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub enum ConfigSettingError {
7070
Other { msg: &'static str },
7171

7272
#[error(transparent)]
73-
Write(#[from] crate::WriteError),
73+
Write(#[from] super::WriteError),
7474
}
7575

7676
impl TEdgeConfigError {

crates/common/tedge_config/src/tedge_toml/figment.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ impl TEdgeEnv {
214214
Uncased::new(
215215
tracing::subscriber::with_default(
216216
tracing::subscriber::NoSubscriber::default(),
217-
|| lowercase_name.parse::<crate::WritableKey>(),
217+
|| lowercase_name.parse::<crate::tedge_toml::WritableKey>(),
218218
)
219219
.map(|key| key.to_string())
220220
.map_err(|err| {
221-
let is_read_only_key = matches!(err, crate::ParseKeyError::ReadOnly(_));
221+
let is_read_only_key = matches!(err, crate::tedge_toml::ParseKeyError::ReadOnly(_));
222222
if is_read_only_key && !WARNINGS.lock().unwrap().insert(lowercase_name.clone()) {
223223
tracing::error!(
224224
"Failed to configure tedge with environment variable `TEDGE_{name}`: {}",
@@ -236,6 +236,8 @@ impl TEdgeEnv {
236236
mod tests {
237237
use std::path::PathBuf;
238238

239+
use crate::tedge_toml::AppendRemoveItem;
240+
use crate::tedge_toml::ReadError;
239241
use serde::Deserialize;
240242
use tedge_config_macros::define_tedge_config;
241243

@@ -381,8 +383,6 @@ mod tests {
381383

382384
#[test]
383385
fn environment_variables_can_override_profiled_configurations() {
384-
use crate::AppendRemoveItem;
385-
use crate::ReadError;
386386
use tedge_config_macros::*;
387387

388388
define_tedge_config!(
@@ -417,8 +417,6 @@ mod tests {
417417

418418
#[test]
419419
fn environment_variable_profile_warnings_use_key_with_correct_format() {
420-
use crate::AppendRemoveItem;
421-
use crate::ReadError;
422420
use tedge_config_macros::*;
423421

424422
define_tedge_config!(
@@ -445,8 +443,6 @@ mod tests {
445443

446444
#[test]
447445
fn toml_profile_warnings_use_key_with_correct_format() {
448-
use crate::AppendRemoveItem;
449-
use crate::ReadError;
450446
use tedge_config_macros::*;
451447

452448
define_tedge_config!(

crates/common/tedge_config/src/tedge_toml/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ pub mod error;
22
mod figment;
33
pub mod models;
44
pub mod tedge_config;
5+
pub use tedge_config::*;
6+
57
pub mod tedge_config_location;

crates/common/tedge_config/src/tedge_toml/tedge_config_location.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ impl TEdgeConfigLocation {
193193
mod tests {
194194
use tedge_test_utils::fs::TempTedgeDir;
195195

196-
use crate::Cloud;
196+
use crate::tedge_toml::Cloud;
197197
use crate::TEdgeConfigReader;
198198

199199
use super::*;

crates/core/c8y_api/src/http_proxy.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ use std::path::PathBuf;
1616
use std::time::Duration;
1717
use tedge_config::models::auth_method::AuthType;
1818
use tedge_config::models::TopicPrefix;
19+
use tedge_config::tedge_toml::ConfigNotSet;
20+
use tedge_config::tedge_toml::MultiError;
21+
use tedge_config::tedge_toml::ReadError;
1922
use tedge_config::CertificateError;
20-
use tedge_config::ConfigNotSet;
21-
use tedge_config::MultiError;
22-
use tedge_config::ReadError;
2323
use tedge_config::TEdgeConfig;
2424
use tracing::debug;
2525
use tracing::error;

crates/core/tedge/src/bridge/aws.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use tedge_api::mqtt_topics::MqttSchema;
99
use tedge_config::models::HostPort;
1010
use tedge_config::models::TopicPrefix;
1111
use tedge_config::models::MQTT_TLS_PORT;
12-
use tedge_config::ProfileName;
12+
use tedge_config::tedge_toml::ProfileName;
1313

1414
#[derive(Debug)]
1515
pub struct BridgeConfigAwsParams {

crates/core/tedge/src/bridge/azure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use tedge_api::mqtt_topics::MqttSchema;
99
use tedge_config::models::HostPort;
1010
use tedge_config::models::TopicPrefix;
1111
use tedge_config::models::MQTT_TLS_PORT;
12-
use tedge_config::ProfileName;
12+
use tedge_config::tedge_toml::ProfileName;
1313

1414
#[derive(Debug)]
1515
pub struct BridgeConfigAzureParams {

crates/core/tedge/src/bridge/c8y.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use tedge_config::models::HostPort;
1313
use tedge_config::models::TemplatesSet;
1414
use tedge_config::models::TopicPrefix;
1515
use tedge_config::models::MQTT_TLS_PORT;
16-
use tedge_config::ProfileName;
16+
use tedge_config::tedge_toml::ProfileName;
1717
use which::which;
1818

1919
#[derive(Debug)]

crates/core/tedge/src/cli/certificate/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use super::upload::*;
88
use anyhow::anyhow;
99
use camino::Utf8PathBuf;
1010
use clap::ValueHint;
11-
use tedge_config::OptionalConfigError;
12-
use tedge_config::ProfileName;
11+
use tedge_config::tedge_toml::OptionalConfigError;
12+
use tedge_config::tedge_toml::ProfileName;
1313
use tedge_config::TEdgeConfig;
1414

1515
use crate::cli::common::Cloud;

0 commit comments

Comments
 (0)