[WIP] config: impl Default for Settings
This commit is contained in:
parent
1d3eb86024
commit
e16837712a
1 changed files with 28 additions and 4 deletions
|
@ -8,10 +8,11 @@
|
|||
//! Realistically we could also just use field names like `cache_dir` and it should have
|
||||
//! the same effect if at some point having the substructs defined like this is annoying.
|
||||
|
||||
use serde::Deserialize;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// primary settings container
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Settings {
|
||||
/// main upload cache setings
|
||||
pub cache: Cache,
|
||||
|
@ -21,8 +22,15 @@ pub struct Settings {
|
|||
pub database: Database,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
// FIXME:
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
/// main upload cache setings
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Cache {
|
||||
/// directory that the cached uploads are stored
|
||||
///
|
||||
|
@ -34,8 +42,16 @@ pub struct Cache {
|
|||
pub dir: PathBuf,
|
||||
}
|
||||
|
||||
impl Default for Cache {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
dir: PathBuf::from("/var/lib/nyazoom/cache"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// static serve settings
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Dist {
|
||||
/// directory that nyazoom serves statically.
|
||||
///
|
||||
|
@ -43,8 +59,16 @@ pub struct Dist {
|
|||
pub dir: PathBuf,
|
||||
}
|
||||
|
||||
impl Default for Dist {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
dir: PathBuf::from("./dist"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// database settings
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Database {
|
||||
/// database url used by [sqlx] to connect to the database
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue