use crate::{bot, database, game, spectate}; use anyhow::{anyhow, Result}; use serde::Deserialize; use std::fs::read_to_string; #[derive(Deserialize)] pub struct Config { pub database: database::Config, pub game: game::Config, pub spectate: spectate::Config, pub bot: bot::Config, } impl Config { pub fn load() -> Result { Ok(toml::from_str(&read_to_string( std::env::args() .nth(1) .ok_or(anyhow!("first arg is the config"))?, )?)?) } }