commit be03e9e8c8d88fe75cd98a0c03f20b8b67bdad5e parent 4e51977ae014e26e345304eb405e35a99dbf64f6 Author: Daniel Barlow <dan@telent.net> Date: Tue, 18 Mar 2025 18:38:04 +0000 service outputs falls back to properties (untested) Diffstat:
| M | pkgs/anoia/svc.fnl | | | 11 | ++++++++--- |
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/pkgs/anoia/svc.fnl b/pkgs/anoia/svc.fnl @@ -51,16 +51,21 @@ (fn open [directory] (let [watcher (watch-fsevents directory) has-file? #(file-exists? (append-path directory $1)) - outputs-dir (append-path directory ".outputs")] + outputs-dir (append-path directory ".outputs") + properties-dir (append-path directory ".properties")] { :wait #(watcher:read) :ready? (fn [self] (and (has-file? ".outputs/state") (not (has-file? ".outputs/.lock")))) - :output (fn [_ filename new-value] + :property (fn [_ filename] + (read-value (append-path properties-dir filename))) + :output (fn [filename new-value] (if new-value (write-value (append-path outputs-dir filename) new-value) - (read-value (append-path outputs-dir filename)))) + (or + (read-value (append-path outputs-dir filename)) + (read-value (append-path properties-dir filename))))) :close #(watcher:close) :fileno #(watcher:fileno) : events