aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Wilken2023-07-24 13:13:50 +0200
committerTimo Wilken2023-08-02 20:28:10 +0200
commit74cbd344269336551d570baaec3f89303c857f50 (patch)
tree6460c976662e0bc9ce2c88f3ad8d243b21480436
parent506d9e9f98ac498389f6c2428c760bf0819c32d7 (diff)
Avoid using `%unset-value' directly
Just don't specify a default value to use it, and use `maybe-value-set?' to check for user-provided values.
-rw-r--r--tw/services/restic.scm38
1 files changed, 18 insertions, 20 deletions
diff --git a/tw/services/restic.scm b/tw/services/restic.scm
index f3ad6f82..b60d49f6 100644
--- a/tw/services/restic.scm
+++ b/tw/services/restic.scm
@@ -35,16 +35,15 @@ restic's repositories and @code{.htpasswd} file, unless otherwise configured
using @code{htpasswd-file}.")
(restic-server (package restic-rest-server) "The restic REST server package to use.")
(bind-address (string ":8000") "The listen address (including port) to bind to.")
- (htpasswd-file (maybe-string %unset-value) "Location of @code{.htpasswd}
-file (default: @code{REPOSITORY-PATH/.htpasswd}). Use @code{htpasswd} from
-the @code{httpd} package to create and/or update this file.")
+ (htpasswd-file (maybe-string) "Location of @code{.htpasswd} file (default:
+@code{REPOSITORY-PATH/.htpasswd}). Use @code{htpasswd} from the @code{httpd}
+package to create and/or update this file.")
(auth? (boolean #t) "Whether to authenticate users at all (using .htpasswd).")
(verify-upload? (boolean #t) "Whether to verify the integrity of uploaded
data. @emph{Do not disable} unless the restic server is to be run on a very
low-power device.")
(append-only? (boolean #f) "Whether to run the restic server in append-only mode.")
- (max-repository-size (maybe-integer %unset-value) "Maximum repository size
-in bytes, if any.")
+ (max-repository-size (maybe-integer) "Maximum repository size in bytes, if any.")
(private-repos-only? (boolean #f) "Whether to let users only access their
private restic repos.")
(prometheus? (boolean #f) "Whether to serve Prometheus metrics.")
@@ -107,25 +106,24 @@ private restic repos.")
(define-maybe list-of-strings)
(define-configuration/no-serialization restic-cleanup-repository
- (schedule gexp "An mcron schedule, specified as a gexp
-(@pxref{G-Expressions}), to use for the cleanup job. String, list or lambda
-syntax is fine (@pxref{Syntax, mcron job specifications,, mcron,
-GNU@tie{}mcron}).")
+ (schedule gexp "An mcron schedule, specified as a gexp (@pxref{G-Expressions}),
+ to use for the cleanup job. String, list or lambda syntax is fine
+(@pxref{Syntax, mcron job specifications,, mcron,GNU@tie{}mcron}).")
(url string "The directory path (or URL) of the restic repository to clean up.")
(password-file string "The file name containing the repository password.
Must be readable by the @code{%restic-user}.")
(restic (package restic) "The restic package to use.")
- (snapshot-paths (maybe-list-of-strings %unset-value) "Only consider
-snapshots which include these paths.")
+ (snapshot-paths (maybe-list-of-strings) "Only consider snapshots which
+include these paths.")
(prune? (boolean #t) "Immediately prune the repo after deleting snapshots.")
- (keep-last (maybe-integer %unset-value) "Keep the last N snapshots.")
- (keep-hourly (maybe-integer %unset-value) "Keep the last N hourly snapshots.")
- (keep-daily (maybe-integer %unset-value) "Keep the last N daily snapshots.")
- (keep-weekly (maybe-integer %unset-value) "Keep the last N weekly snapshots.")
- (keep-monthly (maybe-integer %unset-value) "Keep the last N monthly snapshots.")
- (keep-yearly (maybe-integer %unset-value) "Keep the last N yearly snapshots.")
- (keep-within (maybe-string %unset-value) "Keep snapshots newer than the
-given duration relative to the latest snapshot."))
+ (keep-last (maybe-integer) "Keep the last N snapshots.")
+ (keep-hourly (maybe-integer) "Keep the last N hourly snapshots.")
+ (keep-daily (maybe-integer) "Keep the last N daily snapshots.")
+ (keep-weekly (maybe-integer) "Keep the last N weekly snapshots.")
+ (keep-monthly (maybe-integer) "Keep the last N monthly snapshots.")
+ (keep-yearly (maybe-integer) "Keep the last N yearly snapshots.")
+ (keep-within (maybe-string) "Keep snapshots newer than the given duration
+relative to the latest snapshot."))
(define (restic-cleanup-cronjobs repositories)
(define (arg-with-value arg value)
@@ -137,7 +135,7 @@ true."
(define (to-string thing)
(format #f "~a" thing))
(cond
- ((eq? %unset-value value)
+ ((not (maybe-value-set? value))
'())
((boolean? value)
(if value (list arg) '()))