From fc1e20185ecd5aeb5e36b47db90f8df848fa9502 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Thu, 17 Jul 2025 11:41:28 -0500 Subject: [PATCH] Finish `fn lconf()`. Project-specific vals load Loop over the keys (ignore the "all" one) and repeat the same property extraction process. --- src/config.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 508768a..1d3d63a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -62,7 +62,26 @@ fn lconf(text: &str) -> Result { whole.all.token = get_maybe_property(&table_all, "token")?.cloned(); } } - + + // Loop over the per-project configs, if any. + let per_project_keys = cfg_table + .keys() + .filter(|s| { // Discard the "[all]" table + *s != "all" + }); + + for path in per_project_keys { + let tab = get_table(cfg_table, path)?; + let part_cfg = PartialConfig { + project_path: Some(path.clone()), + gitea_url: get_maybe_property(&tab, "gitea_url")?.cloned(), + owner: get_maybe_property(&tab, "owner")?.cloned(), + repo: get_maybe_property(&tab, "repo")?.cloned(), + token: get_maybe_property(&tab, "token")?.cloned(), + }; + whole.project_overrides.push(part_cfg); + } + println!(" ->> lconf - keys {:?}", cfg_table.keys().collect::>()); Ok(whole) }