summaryrefslogtreecommitdiff
path: root/tw/services/restic.scm
diff options
context:
space:
mode:
authorTimo Wilken2023-04-20 23:42:18 +0200
committerTimo Wilken2023-04-21 14:32:02 +0200
commit4fc1db92aacf2af08bb078267aed2cb45f98b97b (patch)
treed6f582f048b61e09f4d8c3c5094bfcc0c29af535 /tw/services/restic.scm
parent5ddf8241ec2eb8faed264781fedc927e62a3c20d (diff)
Fix restic-server setup
Diffstat (limited to 'tw/services/restic.scm')
-rw-r--r--tw/services/restic.scm12
1 files changed, 8 insertions, 4 deletions
diff --git a/tw/services/restic.scm b/tw/services/restic.scm
index c0c09552..424a3a35 100644
--- a/tw/services/restic.scm
+++ b/tw/services/restic.scm
@@ -15,15 +15,16 @@
(define-maybe/no-serialization string)
;; TODO: implement --tls, --tls-cert and --tls-key, maybe using certbot-service-type?
+;; TODO: implement --log
(define-configuration/no-serialization restic-server-configuration
(repository-path (string "/var/lib/restic") "The directory containing
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 #f) "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 %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.")
(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
@@ -40,8 +41,11 @@ private restic repos.")
(define (restic-server-arguments config)
"Turn CONFIG into a list of arguments to the restic-rest-server executable."
`("--path" ,(restic-server-configuration-repository-path config)
- "--log" "/var/log/restic-server.log"
"--listen" ,(restic-server-configuration-bind-address config)
+ ,@(let ((htpasswd-file (restic-server-configuration-htpasswd-file config)))
+ (if (string? htpasswd-file) `("--htpasswd-file" ,htpasswd-file) '()))
+ ,@(if (restic-server-configuration-auth? config) '() '("--no-auth"))
+ ,@(if (restic-server-configuration-verify-upload? config) '() '("--no-verify-upload"))
,@(if (restic-server-configuration-append-only? config) '("--append-only") '())
,@(let ((max-size (restic-server-configuration-max-repository-size config)))
(if (integer? max-size) `("--max-size" ,max-size) '()))