esp32/build.rs
Thomas Klaehn 18e9f86c36 Initial commit
Signed-off-by: Thomas Klaehn <thomas.klaehn@perinet.io>
2025-02-08 08:48:24 +01:00

23 lines
711 B
Rust

#[toml_cfg::toml_config]
pub struct Config {
#[default("")]
wifi_ssid: &'static str,
#[default("")]
wifi_psk: &'static str,
}
fn main() {
// Check if the `cfg.toml` file exists and has been filled out.
if !std::path::Path::new("cfg.toml").exists() {
panic!("You need to create a `cfg.toml` file with your Wi-Fi credentials! Use `cfg.toml.example` as a template.");
}
// The constant `CONFIG` is auto-generated by `toml_config`.
let app_config = CONFIG;
if app_config.wifi_ssid == "FBI Surveillance Van" || app_config.wifi_psk == "hunter2" {
panic!("You need to set the Wi-Fi credentials in `cfg.toml`!");
}
embuild::espidf::sysenv::output();
}