cdb/src/config.rs
2024-09-08 02:37:39 +02:00

23 lines
464 B
Rust

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()
}