forked from esp-rs/std-training
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
22 lines (19 loc) · 711 Bytes
/
build.rs
File metadata and controls
22 lines (19 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#[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();
}