fix(terminal): detect dev channel from build version string, not env var

This commit is contained in:
Mitchell R 2026-05-22 20:49:41 +02:00
parent 76f725c149
commit 98723f21b8
No known key found for this signature in database
2 changed files with 13 additions and 3 deletions

View file

@ -84,6 +84,11 @@ BF_ENABLE_OS_OTA=1
# (motion, ANPR, analytics, line crossing, etc.) to the BF server +
# Node-RED. Set to 0 if no ONVIF cameras on the network.
BF_ENABLE_ONVIF_EVENTS=1
# Firmware channel for this image. Controls terminal access (dev only)
# and which update channel the kiosk polls. Change to "stable" or "beta"
# for production deployments.
BF_FIRMWARE_CHANNEL=dev
EOF
# Plymouth boot splash

View file

@ -164,9 +164,14 @@ pub fn check_terminal_access() -> Result<(), String> {
if is_locked() {
return Err("locked".to_string());
}
// Check firmware channel — only dev allowed.
let channel = std::env::var("BF_FIRMWARE_CHANNEL").unwrap_or_else(|_| "stable".to_string());
if channel != "dev" {
// Check firmware channel — only dev allowed. The channel comes from
// the server-side kiosk config, delivered via heartbeat. Read from the
// cached bundle or the kiosk_app_version string (dev builds contain
// "-dev." in the version). No env var dependency.
let version = option_env!("BF_BUILD_VERSION")
.unwrap_or(env!("CARGO_PKG_VERSION"));
let is_dev = version.contains("-dev.");
if !is_dev {
return Err("terminal access requires dev channel".to_string());
}
Ok(())