use serde::Deserialize;
use std::{error::Error, fs};
use toml;
use crate::templates::{
exchanges::centralized::ExchangeConfig, experiments::ExpConfig,
features::FeatureConfig,
};
pub mod exchanges;
pub mod experiments;
pub mod features;
#[derive(Debug, Deserialize, Clone)]
pub struct Config {
pub experiments: Vec<ExpConfig>,
pub exchanges: Vec<ExchangeConfig>,
pub features: Option<Vec<FeatureConfig>>,
}
impl Config {
pub fn load_from_toml(file_route: &str) -> Result<Self, Box<dyn Error>> {
let contents = fs::read_to_string(file_route)?;
let config: Config = toml::from_str(&contents)?;
Ok(config)
}
}