//! Entry point for the FUT roster-update host.

fn main() -> std::io::Result<()> {
    // `--identity` so a lifecycle script can ask the binary which commit it was
    // built from, rather than inferring it from a file's mtime. Checking the
    // artifact on disk instead of the running process has already produced one
    // confidently wrong refusal on this project.
    if std::env::args().any(|a| a == "--identity") {
        println!("{}", openfut_roster_host::identity());
        return Ok(());
    }
    let cfg = openfut_roster_host::RosterConfig::from_env()
        .map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidInput, e.to_string()))?;
    openfut_roster_host::serve(cfg)
}
