24 lines
464 B
Rust
24 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()
|
||
|
}
|