From 166d5718790f6457a88cbaf9699cb551d13b0587 Mon Sep 17 00:00:00 2001 From: Xinglu Chen Date: Sun, 7 Mar 2021 10:38:14 +0100 Subject: ui: Make database and config files configurable. It will fallback to the legacy paths, maintaining backward compatibility. * shroud/ui.scm (%default-config): Read environment variable to determine database file. (load-config): Read environment variable to determine config file. --- shroud/ui.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shroud/ui.scm b/shroud/ui.scm index ab78010..31c66fa 100644 --- a/shroud/ui.scm +++ b/shroud/ui.scm @@ -115,12 +115,14 @@ ARGS is the list of arguments received by the 'throw' handler." (report-load-error file args)))) (define %default-config - `((database-file . ,(string-append (getenv "HOME") "/.config/shroud/db.gpg")) + `((database-file . ,(or (getenv "SHROUD_DATABASE_FILE") + (string-append (getenv "HOME") "/.config/shroud/db.gpg"))) (gpg-binary . ,%gpg))) (define (load-config) "Load and evaluate user configuration file." - (let ((config (append (load* (string-append (getenv "HOME") "/.shroud") + (let ((config (append (load* (or (getenv "SHROUD_CONFIG_FILE") + (string-append (getenv "HOME") "/.shroud")) (make-user-module '((shroud config)))) %default-config))) -- cgit v1.2.3