feat(firmware): bake and document git push env vars

build.rs embeds TW_REMOTE_URL / TW_GH_USER / TW_PAT / TW_AUTHOR_* via env!()
so only the git_push binary carries them (the editor references none), and
.env.example documents them. NOTE: TW_PAT lands in the git_push flash image
-- a bench-only shortcut (ADR-005); a product must not embed the PAT.
This commit is contained in:
Julien Calixte
2026-07-06 00:18:22 +02:00
parent 8d80168bda
commit 63ffd7e37a
2 changed files with 25 additions and 3 deletions

View File

@@ -27,7 +27,21 @@ fn main() {
// them in with env!(). Empty when unset: the network spike checks at
// runtime and prints a clear message, so the *editor* build never has to
// carry Wi-Fi creds. Source them from firmware/.env (loaded by `just`).
for var in ["TW_WIFI_SSID", "TW_WIFI_PASS"] {
//
// The TW_REMOTE_URL / TW_GH_USER / TW_PAT / TW_AUTHOR_* vars back Spike 7's
// on-device push (src/bin/git_push.rs). env!() embeds a value only in a
// binary that references it, so the editor binary carries none of these.
// NOTE: TW_PAT ends up in the git_push image — fine for the bench spike, but
// a product must not bake the PAT into flash (ADR-005).
for var in [
"TW_WIFI_SSID",
"TW_WIFI_PASS",
"TW_REMOTE_URL",
"TW_GH_USER",
"TW_PAT",
"TW_AUTHOR_NAME",
"TW_AUTHOR_EMAIL",
] {
let val = std::env::var(var).unwrap_or_default();
println!("cargo:rustc-env={var}={val}");
println!("cargo:rerun-if-env-changed={var}");