heldar-entry 0.1.1

Heldar Access Control — generic ANPR authorization, vehicle/visitor/watchlist registry, guard workflow, and entry reports for gated-entry deployments. Built on the heldar-kernel platform.
Documentation
//! The access-control app's own configuration, loaded from the environment by the composing server. The open
//! kernel does not carry any entry-app tuning knobs.

fn parse_or<T: std::str::FromStr>(key: &str, default: T) -> T {
    std::env::var(key)
        .ok()
        .filter(|s| !s.trim().is_empty())
        .and_then(|v| v.parse().ok())
        .unwrap_or(default)
}

#[derive(Clone, Debug)]
pub struct EntryConfig {
    /// Minimum reads agreeing on a track's winning plate before the ANPR engine commits an entry
    /// event (temporal voting). Lower = faster but noisier; higher = more accurate but more latency.
    pub anpr_min_votes: u32,
    /// How long entry events (+ their evidence frames) are kept before this app's retention prunes them.
    pub entry_retention_days: i64,
}

impl EntryConfig {
    pub fn from_env() -> Self {
        EntryConfig {
            anpr_min_votes: parse_or::<u32>("HELDAR_ANPR_MIN_VOTES", 3).clamp(1, 50),
            entry_retention_days: parse_or("HELDAR_ENTRY_RETENTION_DAYS", 365),
        }
    }
}