Reorganize config file
This commit is contained in:
parent
380756df16
commit
1b8f3c9bc1
2 changed files with 10 additions and 5 deletions
|
|
@ -14,19 +14,24 @@ mod default {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct Config {
|
pub struct Repo {
|
||||||
#[serde(default = "default::repo_update_delay", with = "humantime_serde")]
|
#[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 {
|
fn default() -> Self {
|
||||||
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 {
|
impl Config {
|
||||||
pub fn load(path: &Path) -> anyhow::Result<Self> {
|
pub fn load(path: &Path) -> anyhow::Result<Self> {
|
||||||
info!(path = %path.display(), "Loading config");
|
info!(path = %path.display(), "Loading config");
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,6 @@ pub async fn repeatedly(state: AppState) {
|
||||||
.instrument(debug_span!("update repo"))
|
.instrument(debug_span!("update repo"))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
tokio::time::sleep(state.config.repo_update_delay).await;
|
tokio::time::sleep(state.config.repo.update_delay).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue