Commit

Author:

Hash:

Timestamp:

+14 -0 +/-2 browse

Kevin Schoon [me@kevinschoon.com]

826c74316da16673e84b4ca998763f8d70b7b71a

Wed, 30 Jul 2025 20:25:54 +0000 (3 months ago)

add support for base_path
1diff --git a/ayllu/src/config.rs b/ayllu/src/config.rs
2index 000e65e..99b21b3 100644
3--- a/ayllu/src/config.rs
4+++ b/ayllu/src/config.rs
5 @@ -276,6 +276,8 @@ pub struct Config {
6 pub http: Http,
7 #[serde(default = "Vec::new")]
8 pub collections: Vec<Collection>,
9+ // Optional base directory to resolve relative collections from
10+ pub base_dir: Option<PathBuf>,
11 #[serde(default = "Sites::default")]
12 pub sites: Sites,
13 #[serde(rename = "tree-sitter")]
14 @@ -326,6 +328,14 @@ impl Configurable for Config {
15 )));
16 }
17
18+ if let Some(base_dir) = &self.base_dir {
19+ self.collections.iter_mut().for_each(|collection| {
20+ if collection.path.is_relative() {
21+ collection.path = base_dir.join(&collection.path);
22+ };
23+ });
24+ };
25+
26 Ok(())
27 }
28 }
29 diff --git a/config.example.toml b/config.example.toml
30index 146046f..1df821d 100644
31--- a/config.example.toml
32+++ b/config.example.toml
33 @@ -15,6 +15,10 @@ log_level = "INFO"
34 # have a landing page at the root of your webserver path.
35 subpath_mode = false
36
37+ # When specified collections which do not have a relative path are
38+ # appended to this path. The default is None.
39+ # base_dir = /usr/share/ayllu/repos
40+
41 # friendly message to display on the about page of the main site which might
42 # include details such as contact information, etc. markdown is supported.
43 blurb = """