mqtt client name is now a config option
This commit is contained in:
parent
1a3867d951
commit
1e4d768d25
|
@ -4,6 +4,7 @@ base_url = "https://login.huizinga.dev/api/oidc"
|
|||
[mqtt]
|
||||
host="olympus.vpn.huizinga.dev"
|
||||
port=8883
|
||||
client_name="automation-ares"
|
||||
username="mqtt"
|
||||
password="${MQTT_PASSWORD}"
|
||||
tls=true
|
||||
|
|
|
@ -4,6 +4,7 @@ base_url = "https://login.huizinga.dev/api/oidc"
|
|||
[mqtt]
|
||||
host="mosquitto"
|
||||
port=8883
|
||||
client_name="automation_rs"
|
||||
username="mqtt"
|
||||
password="${MQTT_PASSWORD}"
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ base_url = "https://login.huizinga.dev/api/oidc"
|
|||
[mqtt]
|
||||
host="olympus.lan.huizinga.dev"
|
||||
port=8883
|
||||
client_name="automation-zeus"
|
||||
username="mqtt"
|
||||
password="${MQTT_PASSWORD}"
|
||||
tls=true
|
||||
|
|
|
@ -32,10 +32,11 @@ pub struct OpenIDConfig {
|
|||
pub struct MqttConfig {
|
||||
pub host: String,
|
||||
pub port: u16,
|
||||
pub client_name: String,
|
||||
pub username: String,
|
||||
pub password: String,
|
||||
#[serde(default)]
|
||||
pub tls: bool
|
||||
pub tls: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
|
|
@ -61,7 +61,7 @@ async fn app() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
// Configure MQTT
|
||||
let mqtt = config.mqtt.clone();
|
||||
let mut mqttoptions = MqttOptions::new("rust-test", mqtt.host, mqtt.port);
|
||||
let mut mqttoptions = MqttOptions::new(mqtt.client_name, mqtt.host, mqtt.port);
|
||||
mqttoptions.set_credentials(mqtt.username, mqtt.password);
|
||||
mqttoptions.set_keep_alive(Duration::from_secs(5));
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user