This commit is contained in:
Andras Schmelczer 2024-12-08 18:14:14 +00:00
parent e1ba3d44c7
commit dda356ea00
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
8 changed files with 60 additions and 0 deletions

View file

@ -1,11 +1,19 @@
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct UserConfig {
#[serde(default = "default_users")]
pub user_tokens: Vec<User>,
}
impl UserConfig {
pub fn get_user(&self, token: &str) -> Option<&User> {
self.user_tokens.iter().find(|u| u.token == token)
}
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct User {
pub name: String,