Reorganize config file

This commit is contained in:
Joscha 2023-08-05 00:38:57 +02:00
parent 380756df16
commit 1b8f3c9bc1
2 changed files with 10 additions and 5 deletions

View file

@ -14,19 +14,24 @@ mod default {
}
#[derive(Debug, Deserialize)]
pub struct Config {
pub struct Repo {
#[serde(default = "default::repo_update_delay", with = "humantime_serde")]
pub repo_update_delay: Duration,
pub update_delay: Duration,
}
impl Default for Config {
impl Default for Repo {
fn default() -> Self {
Self {
repo_update_delay: default::repo_update_delay(),
update_delay: default::repo_update_delay(),
}
}
}
#[derive(Debug, Default, Deserialize)]
pub struct Config {
pub repo: Repo,
}
impl Config {
pub fn load(path: &Path) -> anyhow::Result<Self> {
info!(path = %path.display(), "Loading config");