diff options
author | Arun Isaac | 2024-10-24 17:24:25 +0100 |
---|---|---|
committer | Arun Isaac | 2024-10-24 18:23:04 +0100 |
commit | 243ad178cbaae9524a0c29672c285999db4e2c8b (patch) | |
tree | 3cb1f95eee73f5943b35edea5923f4b515ded0e6 /genenetwork/services/genenetwork.scm | |
parent | 38223a084a84fc1415258acdeeb59b63db5a8669 (diff) | |
download | gn-machines-243ad178cbaae9524a0c29672c285999db4e2c8b.tar.gz |
Add sanitizer for log-level configuration field.
* genenetwork/services/genenetwork.scm: Import (guix diagnostics)
and (guix i18n).
(sanitize-log-level): New function.
(<genenetwork-configuration>)[log-level]: Use sanitize-log-level as
the sanitizer.
(<gn-uploader-configuration>)[log-level]: Use sanitize-log-level as
the sanitizer.
Diffstat (limited to 'genenetwork/services/genenetwork.scm')
-rw-r--r-- | genenetwork/services/genenetwork.scm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/genenetwork/services/genenetwork.scm b/genenetwork/services/genenetwork.scm index ef59701..022eeda 100644 --- a/genenetwork/services/genenetwork.scm +++ b/genenetwork/services/genenetwork.scm @@ -30,7 +30,9 @@ #:use-module (gnu system file-systems) #:use-module (gnu system shadow) #:use-module (guix build python-build-system) + #:use-module (guix diagnostics) #:use-module (guix gexp) + #:use-module (guix i18n) #:use-module (guix packages) #:use-module (guix profiles) #:use-module (guix records) @@ -104,7 +106,8 @@ (gn-auth-secrets genenetwork-configuration-gn-auth-secrets (default "/etc/genenetwork")) (log-level genenetwork-configuration-log-level - (default 'warning))) + (default 'warning) + (sanitize sanitize-log-level))) (define-record-type* <gn-uploader-configuration> gn-uploader-configuration make-gn-uploader-configuration @@ -126,7 +129,15 @@ (gn2-server-url gn-uploader-configuration-gn2-server-url (default "https://genenetwork.org")) (log-level gn-uploader-configuration-log-level - (default 'warning))) + (default 'warning) + (sanitize sanitize-log-level))) + +(define (sanitize-log-level log-level) + (case log-level + ((fatal error warning info debug trace) log-level) + (else + (leave (G_ "Log level ~a is invalid. It must be one of the following symbols---fatal, error, warn, info, debug or trace.~%") + log-level)))) (define %genenetwork-accounts (list (user-group |