aboutsummaryrefslogtreecommitdiff
path: root/scripts/guix-data-service.in
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-03-14 12:46:02 +0000
committerChristopher Baines <mail@cbaines.net>2020-03-14 12:46:02 +0000
commita03e1601deda589d5b11a8472438e6fe60c39666 (patch)
tree641a133f92115e6a8885c637b041c8ab88b3b065 /scripts/guix-data-service.in
parent33958eac792bffd1a0ce0e33fcdd2568954323e3 (diff)
downloaddata-service-a03e1601deda589d5b11a8472438e6fe60c39666.tar
data-service-a03e1601deda589d5b11a8472438e6fe60c39666.tar.gz
Improve handling of errors
Adjust the previously unused error page code, and start to use it. Only show the error if configured to do so, to avoid leaking secret information.
Diffstat (limited to 'scripts/guix-data-service.in')
-rw-r--r--scripts/guix-data-service.in14
1 files changed, 13 insertions, 1 deletions
diff --git a/scripts/guix-data-service.in b/scripts/guix-data-service.in
index 5822b52..b1946a5 100644
--- a/scripts/guix-data-service.in
+++ b/scripts/guix-data-service.in
@@ -25,12 +25,14 @@
(use-modules (srfi srfi-1)
(srfi srfi-37)
+ (ice-9 match)
(ice-9 textual-ports)
(system repl server)
(gcrypt pk-crypto)
(guix pki)
(guix-data-service config)
(guix-data-service web server)
+ (guix-data-service web controller)
(guix-data-service web nar controller))
(define %default-repl-server-port
@@ -68,6 +70,9 @@
(option '("update-database") #f #f
(lambda (opt name _ result)
(alist-cons 'update-database #t result)))
+ (option '("show-error-details") #f #f
+ (lambda (opt name _ result)
+ (alist-cons 'show-error-details #t result)))
(option '("port") #t #f
(lambda (opt name arg result)
(alist-cons 'port
@@ -86,6 +91,11 @@
(narinfo-signing-public-key . ,%public-key-file)
(narinfo-signing-private-key . ,%private-key-file)
(update-database . #f)
+ (show-error-details
+ . ,(match (getenv "GUIX_DATA_SERVICE_SHOW_ERROR_DETAILS")
+ (#f #f)
+ ("" #f)
+ (_ #t)))
(port . 8765)
(host . "0.0.0.0")))
@@ -170,7 +180,9 @@
key args)
(display "warning: not signing narinfo files\n"
(current-error-port))
- #f))))
+ #f)))
+ (%show-error-details
+ (assoc-ref opts 'show-error-details)))
(start-guix-data-service-web-server (assq-ref opts 'port)
(assq-ref opts 'host)