working mqtt now

This commit is contained in:
Priec
2026-01-08 15:59:44 +01:00
parent d47060e5dd
commit 70c37c344b
4 changed files with 98 additions and 118 deletions

View File

@@ -1,7 +1,8 @@
fn main() {
// load .env and pass SSID/PASSWORD to compiler
if let Ok(dotenv_path) = dotenvy::dotenv() {
// Only rebuild if .env changes
// Explicitly load .env from the project root, even when called from other dirs
let project_root = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let dotenv_path = std::path::Path::new(&project_root).join(".env");
if dotenvy::from_path(dotenv_path.clone()).is_ok() {
println!("cargo:rerun-if-changed={}", dotenv_path.display());
}
@@ -12,8 +13,6 @@ fn main() {
if let Ok(password) = std::env::var("PASSWORD") {
println!("cargo:rustc-env=PASSWORD={}", password);
}
// Export BROKER_IP and PORT as string envs also (optional, for debugging)
if let Ok(ip) = std::env::var("BROKER_IP") {
println!("cargo:rustc-env=BROKER_IP={}", ip);
}
@@ -22,7 +21,7 @@ fn main() {
}
linker_be_nice();
// make sure linkall.x is the last linker script
println!("cargo:rustc-link-arg=-Tlinkall.x");
}