Automatically create admin on first start

This commit is contained in:
2022-03-29 19:32:31 +02:00
parent 2d062320a7
commit b4e8113706
13 changed files with 1773 additions and 2 deletions

19
src/data/app_config.rs Normal file
View File

@ -0,0 +1,19 @@
use std::path::{Path, PathBuf};
use rocket::serde::Deserialize;
use crate::constants::USERS_LIST_FILE;
#[derive(Debug, Deserialize)]
#[serde(crate = "rocket::serde")]
pub struct AppConfig {
storage_path: PathBuf,
}
impl AppConfig {
pub fn storage_path(&self) -> &Path {
self.storage_path.as_ref()
}
pub fn users_file(&self) -> PathBuf {
self.storage_path.join(USERS_LIST_FILE)
}
}