blob: 5d17bfc083bb5e77cc7802a8522b0823e40d0fb5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
use std::path::PathBuf;
use anyhow::Context;
use serde::Deserialize;
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))?;
let config = toml::from_slice(&toml)
.with_context(|| format!("Failed to parse config file at {:#?}", path))?;
Ok(config)
}
#[derive(Debug, Default, Deserialize)]
pub struct Config {
pub repositories: Vec<RepoConfig>,
}
#[derive(Debug, Deserialize)]
pub struct RepoConfig {
pub remote_git_repo: String,
pub local_git_repo: String,
pub remote_package_repo: String,
}
|