Default to autoreload theme
More convenient for devel
- Id
- 694af64641226b74ec4425f09af4b8f3ae0b9346
- Author
- Caio
- Commit time
- 2024-03-02T14:35:39+01:00
Modified caca/src/config.rs
log_size: NonZeroUsize::new(30).unwrap(),
allow_http_clone: true,
cache_size: NonZeroUsize::new(1000).unwrap(),
- theme: Theme::Static,
+ theme: Theme::AutoReload(String::from("caca/theme")),
num_threads: None,
export_all: true, // false => require git-daemon-export-ok
listen_mode: ListenMode::addr("[::]:42080").expect("valid default socket addr"),
},
global_mailmap: Some("/etc/caca/mailmap".into()),
listen_mode: ListenMode::External,
+ theme: Theme::Static,
..Default::default()
};
config.check().expect("valid live config")
self.site.base_url.clone()
}
- fn from_bytes(data: &[u8]) -> crate::Result<Self> {
+ pub fn from_bytes(data: &[u8]) -> crate::Result<Self> {
let mut config = Self::default();
let mut first_err: Option<Box<dyn std::error::Error>> = None;
urso::config::parse(data, |section, _subsection, key, value| -> bool {
}
"core" => {
match key {
+ "static-theme" => match from_utf8(value) {
+ Ok(true) => config.theme = Theme::Static,
+ Ok(false) => {} // autoreload
+ Err(err) => {
+ first_err = Some(err);
+ return false;
+ }
+ },
"theme" => {
config.theme =
Theme::AutoReload(String::from_utf8_lossy(value).into_owned());
[core]
listen = external
global-mailmap = /etc/caca/mailmap
+static-theme = true
";
assert_eq!(