use central_backend::app_config::AppConfig; use central_backend::crypto::pki; use central_backend::server::{secure_server, unsecure_server}; use central_backend::utils::files_utils::create_directory_if_missing; use futures::future; #[actix_web::main] async fn main() -> std::io::Result<()> { // Initialize OpenSSL openssl_sys::init(); env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); // Initialize storage create_directory_if_missing(AppConfig::get().pki_path()).unwrap(); // Initialize PKI pki::initialize_root_ca().expect("Failed to initialize Root CA!"); pki::initialize_web_ca().expect("Failed to initialize web CA!"); pki::initialize_devices_ca().expect("Failed to initialize devices CA!"); pki::initialize_server_ca().expect("Failed to initialize server certificate!"); pki::refresh_crls().expect("Failed to initialize Root CA!"); let s1 = secure_server(); let s2 = unsecure_server(); future::try_join(s1, s2) .await .expect("Failed to start servers!"); Ok(()) }