Environment variables can now be used directly inside the config instead of requiring special handling

This commit is contained in:
2023-01-06 04:06:36 +01:00
parent 82859d8e46
commit d06c0b6980
6 changed files with 39 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
#![feature(async_closure)]
use std::{time::Duration, sync::{Arc, RwLock}, process, net::SocketAddr};
use std::{time::Duration, sync::{Arc, RwLock}, process};
use axum::{Router, Json, routing::post, http::StatusCode, extract::FromRef};
@@ -45,7 +45,7 @@ async fn main() {
// Configure MQTT
let mut mqttoptions = MqttOptions::new("rust-test", config.mqtt.host, config.mqtt.port);
mqttoptions.set_credentials(config.mqtt.username, config.mqtt.password.unwrap());
mqttoptions.set_credentials(config.mqtt.username, config.mqtt.password);
mqttoptions.set_keep_alive(Duration::from_secs(5));
mqttoptions.set_transport(Transport::tls_with_default_config());