diff --git a/src/config.rs b/src/config.rs index 4ec26ff..2f59d7b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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 { info!(path = %path.display(), "Loading config"); diff --git a/src/update.rs b/src/update.rs index d01be80..b42cadf 100644 --- a/src/update.rs +++ b/src/update.rs @@ -125,6 +125,6 @@ pub async fn repeatedly(state: AppState) { .instrument(debug_span!("update repo")) .await; - tokio::time::sleep(state.config.repo_update_delay).await; + tokio::time::sleep(state.config.repo.update_delay).await; } }