From 082b4cc28a23f3997ee053fcf552cd5fac2194b2 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Wed, 27 Oct 2021 17:03:50 +0200 Subject: [PATCH] init bastion --- Cargo.toml | 4 ++++ src/lib.rs | 31 +++++++++++++++++-------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8eb2b47..2217a5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,10 @@ lazy_static = "1.4.0" uuid = { version = "0.8.2", features = ["serde", "v4"] } async-trait = "0.1.51" +# Runtime +bastion = "0.4" +nuclei = { version = "0.1.3" } + # Catch&Handle POSIX process signals signal-hook = "0.3.9" diff --git a/src/lib.rs b/src/lib.rs index d0bfd20..bb441d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,23 +24,26 @@ pub mod error; pub mod config; mod permissions; -/* -use clap::{App, Arg}; +mod runtime { + use bastion::prelude::*; -use std::io; -use std::io::Write; -use std::path::PathBuf; -use std::str::FromStr; + pub fn startup() { + let config = Config::new().hide_backtraces(); -use std::sync::Arc; + Bastion::init_with(config); -use smol::Executor; + Bastion::start(); -use error::Error; + let sup = Bastion::supervisor(|sp| { + sp .with_strategy(SupervisionStrategy::OneForAll) + .children(|children| { + children + }) + }).expect("Failed to create supervisor"); + } -use slog::Logger; - -use paho_mqtt::AsyncClient; -use crate::config::Config; -*/ + pub fn run() { + Bastion::block_until_stopped() + } +} \ No newline at end of file