summaryrefslogtreecommitdiffstats
path: root/crates/core/tedge/src/cli/connect/common_mosquitto_config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/core/tedge/src/cli/connect/common_mosquitto_config.rs')
-rw-r--r--crates/core/tedge/src/cli/connect/common_mosquitto_config.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/core/tedge/src/cli/connect/common_mosquitto_config.rs b/crates/core/tedge/src/cli/connect/common_mosquitto_config.rs
index 7fd9a28b..68af7d00 100644
--- a/crates/core/tedge/src/cli/connect/common_mosquitto_config.rs
+++ b/crates/core/tedge/src/cli/connect/common_mosquitto_config.rs
@@ -118,9 +118,10 @@ impl CommonMosquittoConfig {
Ok(())
}
- pub fn with_internal_opts(self, port: u16) -> Self {
+ pub fn with_internal_opts(self, port: u16, bind_address: String) -> Self {
let internal_listener = ListenerConfig {
port: Some(port),
+ bind_address: Some(bind_address),
..self.internal_listener
};
Self {
@@ -198,10 +199,10 @@ fn test_serialize() -> anyhow::Result<()> {
fn test_serialize_with_opts() -> anyhow::Result<()> {
let common_mosquitto_config = CommonMosquittoConfig::default();
let mosquitto_config_with_opts = common_mosquitto_config
- .with_internal_opts(1234)
+ .with_internal_opts(1234, "1.2.3.4".into())
.with_external_opts(
Some(2345),
- Some("0.0.0.0".into()),
+ Some("0.0.0.0".to_string()),
Some("wlan0".into()),
Some("/etc/ssl/certs".into()),
Some("cert.pem".into()),
@@ -227,7 +228,7 @@ fn test_serialize_with_opts() -> anyhow::Result<()> {
"log_type subscribe\n",
"log_type unsubscribe\n",
"message_size_limit 268435455\n",
- "listener 1234 localhost\n",
+ "listener 1234 1.2.3.4\n",
"allow_anonymous true\n",
"require_certificate false\n",
"listener 2345 0.0.0.0\n",