aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 4788174..5781b00 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -92,6 +92,7 @@ async fn main() -> anyhow::Result<()> {
conf_path.push(format!("{PROGRAM}.toml"));
let conf = config::load(&conf_path)
.with_context(|| format!("Failed to load config: {:?}", &conf_path))?;
+
stderrlog::new()
.color(stderrlog::ColorChoice::Never)
.module(module_path!())
@@ -103,9 +104,12 @@ async fn main() -> anyhow::Result<()> {
})
.init()
.unwrap();
+
// TODO: This will print creds
trace!("Configuration: {conf:?}");
+
let (client, mut event_loop) = conf.mqtt_client();
+
for (topic, route) in conf.routes.iter() {
if let Err(e) = client.subscribe(topic, route.qos.unwrap_or(conf.qos)).await {
warn!("Failed to subscribe to '{topic}': {e:?}");
@@ -113,6 +117,7 @@ async fn main() -> anyhow::Result<()> {
debug!("Subscribed to: '{topic}'");
}
}
+
moro_local::async_scope!(|scope| -> anyhow::Result<()> {
loop {
let notification = event_loop.poll().await;