rceaadb/src/config.rs

19 lines
486 B
Rust
Raw Normal View History

2020-01-02 23:10:28 +01:00
use super::commands::*;
use serde::Deserialize;
use std::fs;
pub fn read_config() -> String {
fs::read_to_string("config.toml").expect("Could not read config file. Make sure a file named config.toml exists in the current working directory.")
}
#[derive(Deserialize, Debug)]
pub struct Config {
#[serde(rename = "command")]
pub commands: Vec<Command>,
pub secret: String,
}
lazy_static! {
pub static ref CONFIG: Config = toml::from_str(&read_config()).unwrap();
}