add anyhow, serde, toml, dirs

This commit is contained in:
2026-05-15 14:37:15 +01:00
parent e433feddbe
commit 2068342144
4 changed files with 159 additions and 6 deletions
+22
View File
@@ -0,0 +1,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,
}
+2
View File
@@ -1,5 +1,7 @@
#[macro_use] extern crate rocket;
mod config;
#[launch]
fn rocket() -> _ {
rocket::build().mount("/", routes![index])