krata/hypha/bin/container.rs

24 lines
805 B
Rust
Raw Normal View History

use env_logger::Env;
use anyhow::{anyhow, Result};
2024-01-22 10:15:53 +00:00
use hypha::container::init::ContainerInit;
use std::env;
2024-01-17 16:18:12 +00:00
fn main() -> Result<()> {
env::set_var("RUST_BACKTRACE", "1");
env_logger::Builder::from_env(Env::default().default_filter_or("warn")).init();
if env::var("HYPHA_UNSAFE_ALWAYS_ALLOW_INIT").unwrap_or("0".to_string()) != "1" {
let pid = std::process::id();
if pid > 3 {
return Err(anyhow!(
"not running because the pid of {} indicates this is probably not \
the right context for the init daemon. \
run with HYPHA_UNSAFE_ALWAYS_ALLOW_INIT=1 to bypass this check",
pid
));
}
}
2024-01-22 10:15:53 +00:00
let mut container = ContainerInit::new();
container.init()?;
2024-01-17 16:18:12 +00:00
Ok(())
}