refactor the main structure

This commit is contained in:
2023-09-25 21:09:21 +02:00
parent 40385bbae2
commit 8b13c52b97
11 changed files with 57 additions and 68 deletions

18
src/deploy/starter.rs Normal file
View File

@@ -0,0 +1,18 @@
use bollard::Docker;
use crate::controller::Controller;
pub async fn start_docker() -> Controller{
let docker = match Docker::connect_with_local_defaults() {
Ok(d) => d,
Err(e) => panic!("error:{}",e.to_string()),
};
env_logger::init_from_env(env_logger::Env::new().default_filter_or("debug"));
let controller = match Controller::new(docker,
"customnetwork".to_string(),
"172.20.0.0/24".to_string()).await {
Ok(c) => c,
Err(e) => panic!("error: {}",e),
};
controller.load_all_instances().await;
return controller;
}