diff options
| author | Joe Carstairs <me@joeac.net> | 2026-05-15 15:27:33 +0100 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2026-05-15 15:27:33 +0100 |
| commit | f849de20bb3ef7a36a5806108d853c577609991e (patch) | |
| tree | fd1e888d3d3bb8077483eed83bf9d2fcfb7c32dc /src/config.rs | |
| parent | 2068342144fe093efba9b9ff080017d294da7b6d (diff) | |
can configure repositories, hello world response
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/config.rs b/src/config.rs index f27f5f9..5d17bfc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,22 +1,24 @@ +use std::path::PathBuf; + use anyhow::Context; use serde::Deserialize; -fn read_config(path: &str) -> anyhow::Result<Config> { +pub fn read_config(path: &PathBuf) -> anyhow::Result<Config> { let toml = std::fs::read(path) - .with_context(|| format!("Failed to read config file at {path}"))?; + .with_context(|| format!("Failed to read config file at {:#?}", path))?; let config = toml::from_slice(&toml) - .with_context(|| format!("Failed to parse config file at {path}"))?; + .with_context(|| format!("Failed to parse config file at {:#?}", path))?; Ok(config) } -#[derive(Deserialize)] +#[derive(Debug, Default, Deserialize)] pub struct Config { - repositories: Vec<RepoConfig>, + pub repositories: Vec<RepoConfig>, } -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] pub struct RepoConfig { - remote_git_repo: String, - local_git_repo: String, - remote_package_repo: String, + pub remote_git_repo: String, + pub local_git_repo: String, + pub remote_package_repo: String, } |
