Skip to content

Commit a270e0a

Browse files
committed
Address deny complaints, re-enable mqtt5 and zenoh plugins
1 parent c14085c commit a270e0a

File tree

5 files changed

+63
-72
lines changed

5 files changed

+63
-72
lines changed

Cargo.lock

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deny.toml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,12 @@
1414
# Config file for cargo deny
1515
# For all options see https://github.com/EmbarkStudios/cargo-deny/blob/main/deny.template.toml
1616

17-
[advisories]
18-
ignore = ["RUSTSEC-2023-0071", "RUSTSEC-2024-0436"]
19-
2017
[bans]
2118
multiple-versions = "allow"
2219

2320
# If you add a license in the following section also consider changing about.toml
2421
[licenses]
25-
allow = [
26-
"Apache-2.0",
27-
"BSD-2-Clause",
28-
"BSD-3-Clause",
29-
"CDLA-Permissive-2.0",
30-
"EPL-2.0",
31-
"ISC",
32-
"MIT",
33-
"MPL-2.0",
34-
"OpenSSL",
35-
"Unicode-3.0",
36-
"Zlib",
37-
]
22+
allow = ["Apache-2.0", "BSD-2-Clause", "MIT", "Unicode-3.0"]
3823

3924
[[licenses.clarify]]
4025
name = "ring"

up-subscription-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ up-transport-mqtt5 = { version = "0.4.0", optional = true }
4545
up-transport-zenoh = { version = "0.9.0", optional = true }
4646

4747
[target.'cfg(unix)'.dependencies]
48-
daemonize = { version = "0.5" }
48+
daemonize2 = { version = "0.6" }

up-subscription-cli/src/main.rs

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ use up_rust::{LocalUriProvider, UTransport};
2121
use up_subscription::{ConfigurationError, USubscriptionConfiguration, USubscriptionService};
2222

2323
#[cfg(unix)]
24-
use daemonize::Daemonize;
24+
use daemonize2::Daemonize;
2525

26-
// #[cfg(feature = "mqtt5")]
27-
// use up_transport_mqtt5::Mqtt5TransportOptions;
26+
#[cfg(feature = "mqtt5")]
27+
use up_transport_mqtt5::Mqtt5TransportOptions;
2828

29-
// #[cfg(feature = "zenoh")]
30-
// use crate::transport::zenoh::ZenohArgs;
29+
#[cfg(feature = "zenoh")]
30+
use crate::transport::zenoh::ZenohArgs;
3131

3232
mod transport;
3333
#[cfg(feature = "local")]
3434
use transport::get_local_transport;
35-
// #[cfg(feature = "mqtt5")]
36-
// use transport::get_mqtt5_transport;
37-
// #[cfg(feature = "zenoh")]
38-
// use transport::get_zenoh_transport;
35+
#[cfg(feature = "mqtt5")]
36+
use transport::get_mqtt5_transport;
37+
#[cfg(feature = "zenoh")]
38+
use transport::get_zenoh_transport;
3939

4040
fn between_1_and_1024(s: &str) -> Result<usize, String> {
4141
number_range(s, 1, 1024)
@@ -71,10 +71,10 @@ enum Transport {
7171
None,
7272
#[cfg(feature = "local")]
7373
Local,
74-
// #[cfg(feature = "mqtt5")]
75-
// Mqtt5,
76-
// #[cfg(feature = "zenoh")]
77-
// Zenoh,
74+
#[cfg(feature = "mqtt5")]
75+
Mqtt5,
76+
#[cfg(feature = "zenoh")]
77+
Zenoh,
7878
}
7979

8080
// All our args
@@ -113,27 +113,32 @@ pub(crate) struct Args {
113113
/// Increase verbosity of output, default is false (reduced verbosity)
114114
#[arg(short, long, env, default_value_t = false)]
115115
verbose: bool,
116-
// #[cfg(feature = "mqtt5")]
117-
// #[command(flatten)]
118-
// mqtt_args: Mqtt5TransportOptions,
119116

120-
// #[cfg(feature = "zenoh")]
121-
// #[command(flatten)]
122-
// zenoh_args: ZenohArgs,
117+
#[cfg(feature = "mqtt5")]
118+
#[command(flatten)]
119+
mqtt_args: Mqtt5TransportOptions,
120+
121+
#[cfg(feature = "zenoh")]
122+
#[command(flatten)]
123+
zenoh_args: ZenohArgs,
123124
}
124125

125126
#[tokio::main]
126127
async fn main() {
127128
let args = Args::parse();
128129

129130
// Setup logging, get configuration
130-
std::env::set_var("RUST_LOG", "info");
131-
// #[cfg(feature = "zenoh")]
132-
// std::env::set_var("RUST_LOG", "info,zenoh=warn");
133-
if args.verbose {
134-
std::env::set_var("RUST_LOG", "trace");
135-
// #[cfg(feature = "zenoh")]
136-
// std::env::set_var("RUST_LOG", "trace,zenoh=info");
131+
unsafe {
132+
// accept unsafe for now, as at this point this program definiely is not multi-threaded
133+
std::env::set_var("RUST_LOG", "info");
134+
#[cfg(feature = "zenoh")]
135+
std::env::set_var("RUST_LOG", "info,zenoh=warn");
136+
137+
if args.verbose {
138+
std::env::set_var("RUST_LOG", "trace");
139+
#[cfg(feature = "zenoh")]
140+
std::env::set_var("RUST_LOG", "trace,zenoh=info");
141+
}
137142
}
138143
up_subscription::init_once();
139144

@@ -153,20 +158,20 @@ async fn main() {
153158
.inspect_err(|e| panic!("Error setting up local transport: {}", e.get_message()))
154159
.unwrap(),
155160
),
156-
// #[cfg(feature = "mqtt5")]
157-
// Transport::Mqtt5 => Some(
158-
// get_mqtt5_transport(_config.clone(), args.mqtt_args)
159-
// .await
160-
// .inspect_err(|e| panic!("Error setting up MQTT5 transport: {}", e.get_message()))
161-
// .unwrap(),
162-
// ),
163-
// #[cfg(feature = "zenoh")]
164-
// Transport::Zenoh => Some(
165-
// get_zenoh_transport(_config.clone(), args.zenoh_args)
166-
// .await
167-
// .inspect_err(|e| panic!("Error setting up Zenoh transport: {}", e.get_message()))
168-
// .unwrap(),
169-
// ),
161+
#[cfg(feature = "mqtt5")]
162+
Transport::Mqtt5 => Some(
163+
get_mqtt5_transport(_config.clone(), args.mqtt_args)
164+
.await
165+
.inspect_err(|e| panic!("Error setting up MQTT5 transport: {}", e.get_message()))
166+
.unwrap(),
167+
),
168+
#[cfg(feature = "zenoh")]
169+
Transport::Zenoh => Some(
170+
get_zenoh_transport(_config.clone(), args.zenoh_args)
171+
.await
172+
.inspect_err(|e| panic!("Error setting up Zenoh transport: {}", e.get_message()))
173+
.unwrap(),
174+
),
170175
Transport::None => None,
171176
};
172177

@@ -188,7 +193,7 @@ async fn main() {
188193
#[cfg(unix)]
189194
if args.daemon {
190195
let daemonize = Daemonize::new();
191-
match daemonize.start() {
196+
match unsafe { daemonize.start() } {
192197
Ok(_) => {
193198
debug!("Success, running daemonized");
194199
}

up-subscription-cli/src/transport/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ pub(crate) mod local;
1616
#[cfg(feature = "local")]
1717
pub(crate) use local::get_local_transport;
1818

19-
// #[cfg(feature = "mqtt5")]
20-
// pub(crate) mod mqtt5;
21-
// #[cfg(feature = "mqtt5")]
22-
// pub(crate) use mqtt5::get_mqtt5_transport;
19+
#[cfg(feature = "mqtt5")]
20+
pub(crate) mod mqtt5;
21+
#[cfg(feature = "mqtt5")]
22+
pub(crate) use mqtt5::get_mqtt5_transport;
2323

24-
// #[cfg(feature = "zenoh")]
25-
// pub(crate) mod zenoh;
26-
// #[cfg(feature = "zenoh")]
27-
// pub(crate) use zenoh::get_zenoh_transport;
24+
#[cfg(feature = "zenoh")]
25+
pub(crate) mod zenoh;
26+
#[cfg(feature = "zenoh")]
27+
pub(crate) use zenoh::get_zenoh_transport;

0 commit comments

Comments
 (0)