summaryrefslogtreecommitdiff
path: root/src/config.rs
blob: f27f5f937371a5fb181dde3b875e7d610c79f2f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use anyhow::Context;
use serde::Deserialize;

fn read_config(path: &str) -> anyhow::Result<Config> {
    let toml = std::fs::read(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}"))?;
    Ok(config)
}

#[derive(Deserialize)]
pub struct Config {
    repositories: Vec<RepoConfig>,
}

#[derive(Deserialize)]
pub struct RepoConfig {
    remote_git_repo: String,
    local_git_repo: String,
    remote_package_repo: String,
}