2024-01-31 09:40:42 +00:00
|
|
|
use anyhow::{anyhow, Result};
|
2024-02-01 10:36:54 +00:00
|
|
|
use env_logger::Env;
|
2024-01-22 10:15:53 +00:00
|
|
|
use hypha::container::init::ContainerInit;
|
2024-01-31 09:40:42 +00:00
|
|
|
use std::env;
|
2024-01-17 16:18:12 +00:00
|
|
|
|
|
|
|
fn main() -> Result<()> {
|
2024-01-31 04:22:48 +00:00
|
|
|
env::set_var("RUST_BACKTRACE", "1");
|
2024-02-01 10:28:17 +00:00
|
|
|
env_logger::Builder::from_env(Env::default().default_filter_or("warn")).init();
|
2024-01-31 09:40:42 +00:00
|
|
|
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(())
|
|
|
|
}
|