From 4fc1db92aacf2af08bb078267aed2cb45f98b97b Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Thu, 20 Apr 2023 23:42:18 +0200 Subject: Fix restic-server setup --- tw/services/restic.scm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tw/services/restic.scm') 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) '())) -- cgit v1.2.3