Automatically create admin on first start
This commit is contained in:
19
src/data/app_config.rs
Normal file
19
src/data/app_config.rs
Normal 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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user