blob: 678074eef499b44851e28db3693473d237dabd25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
use crate::{game, spectate};
use anyhow::{anyhow, Result};
use serde::Deserialize;
use std::fs::read_to_string;
#[derive(Deserialize)]
pub struct Config {
pub game: game::Config,
pub spectate: spectate::Config,
}
impl Config {
pub fn load() -> Result<Self> {
Ok(toml::from_str(&read_to_string(
std::env::args()
.nth(1)
.ok_or(anyhow!("first arg is the config"))?,
)?)?)
}
}
|