From 2068342144fe093efba9b9ff080017d294da7b6d Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Fri, 15 May 2026 14:37:15 +0100 Subject: add anyhow, serde, toml, dirs --- src/config.rs | 22 ++++++++++++++++++++++ src/main.rs | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 src/config.rs (limited to 'src') diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..f27f5f9 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,22 @@ +use anyhow::Context; +use serde::Deserialize; + +fn read_config(path: &str) -> anyhow::Result { + 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, +} + +#[derive(Deserialize)] +pub struct RepoConfig { + remote_git_repo: String, + local_git_repo: String, + remote_package_repo: String, +} diff --git a/src/main.rs b/src/main.rs index af7b49a..2c4d073 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,7 @@ #[macro_use] extern crate rocket; +mod config; + #[launch] fn rocket() -> _ { rocket::build().mount("/", routes![index]) -- cgit v1.2.3