cdb/src/config.rs

24 lines
464 B
Rust
Raw Normal View History

2024-09-08 00:37:39 +00:00
use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
pub struct Config {
/// Allowed tokens for access
pub allowed_tokens: Vec<String>,
}
impl Default for Config {
fn default() -> Self {
Self {
allowed_tokens: Vec::new(),
}
}
}
pub fn get_config() -> Config {
if let Ok(content) = std::fs::read_to_string("./config.toml") {
return toml::from_str(&content).unwrap();
}
Config::default()
}