diff options
-rw-r--r-- | CHANGELOG.md | 8 | ||||
-rw-r--r-- | src/config.rs | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 73d6a84..59d771c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ SPDX-License-Identifier: CC-BY-SA-4.0 # Changelog +## [Unreleased] + +### Changed + +* BREAKING: The MQTT client ID is now set to the `id` config setting directly + rather than `id` followed by the PID. + ## [0.3.0] - 2025-07-10 ### Added @@ -51,6 +58,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0 gessage, receive the message on stdin and the topic as an argument. * Configure an MQTT server using a host, port and optional credentials. +[Unreleased]: https://the-tk.com/cgit/mqttr/diff/?id=HEAD&id2=v0.3.0 [0.3.0]: https://the-tk.com/cgit/mqttr/diff/?id=v0.3.0&id2=v0.2.0 [0.2.0]: https://the-tk.com/cgit/mqttr/diff/?id=v0.2.0&id2=v0.1.0 [0.1.0]: https://the-tk.com/cgit/mqttr/tag/?h=v0.1.0 diff --git a/src/config.rs b/src/config.rs index c110825..b04b72c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -3,7 +3,7 @@ use std::{ collections::HashMap, fmt, fs::File, io::Read, os::unix::fs::PermissionsExt, path::Path, - process, time::Duration, + time::Duration, }; use anyhow::bail; @@ -280,7 +280,7 @@ pub struct Config { impl Config { pub fn mqtt_client(&self) -> (AsyncClient, EventLoop) { - let client_id = format!("{}_{}", self.id, process::id()); + let client_id = self.id.to_string(); let mut options = MqttOptions::new(client_id, &self.host, self.port); if let Some(credentials) = &self.credentials { options.set_credentials(&credentials.username, &credentials.password); |