Commit

Author:

Hash:

Timestamp:

+5 -5 +/-1 browse

Kevin Schoon [me@kevinschoon.com]

1b04882a197459a2cc85d995f9a602213078e382

Sun, 20 Jul 2025 15:24:13 +0000 (4 months ago)

fix broken sites config
1diff --git a/ayllu/src/web2/middleware/sites.rs b/ayllu/src/web2/middleware/sites.rs
2index 65e1459..8c38452 100644
3--- a/ayllu/src/web2/middleware/sites.rs
4+++ b/ayllu/src/web2/middleware/sites.rs
5 @@ -40,8 +40,8 @@ pub fn sites(cfg: &Config) -> Result<Sites, Error> {
6 for path in repositories(&cfg.collections)? {
7 let repository = Repository::new(path.as_path())?;
8 let repo_config = repository.config()?;
9- if repo_config.sites.header.is_some() {
10- let domain = repo_config.sites.header.unwrap();
11+ if let Some(sites_cfg) = repo_config.sites {
12+ let domain = sites_cfg.header.unwrap(); // FIXME
13 match domain.split_once('=') {
14 Some((key, value)) => {
15 let repo_path = path.to_str().unwrap().to_string();
16 @@ -95,8 +95,8 @@ pub async fn middleware(
17 .to_path_buf()
18 },
19 );
20- let blob_path = config
21- .sites
22+ let sites_config = config.sites.expect("sites not configured");
23+ let blob_path = sites_config
24 .content
25 .map_or(PathBuf::from("public").join(path.clone()), |base| {
26 PathBuf::from(base).join(path.clone())
27 @@ -120,7 +120,7 @@ pub async fn middleware(
28 log::debug!("trying paths: {paths:?}");
29 for path in paths {
30 log::debug!("trying path {path:?}");
31- if let Some(blob) = repository.blob(path.as_path(), config.sites.branch.clone())? {
32+ if let Some(blob) = repository.blob(path.as_path(), sites_config.branch.clone())? {
33 log::debug!("got blob from path {path:?}");
34 let mime_type = from_path(path.to_str().unwrap()).first_or_octet_stream();
35 let response = Response::builder()