1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
mod interactive;
mod monitor;
mod standard;

use crate::{
    args::Args,
    config::{Config, SessionMode},
    error::Error,
};
pub use monitor::run_health_check;
use std::fs::File;

pub fn spawn_network(args: Args) -> Result<(), Error> {
    let config: Config = serde_yaml::from_reader(File::open(&args.config)?)?;

    match &config.session.mode {
        SessionMode::Standard => standard::spawn_network(config, args),
        SessionMode::Monitor => monitor::spawn_network(config, args),
        SessionMode::Interactive => interactive::spawn_network(config),
    }
}