refactor the main structure
This commit is contained in:
18
src/deploy/starter.rs
Normal file
18
src/deploy/starter.rs
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user