diff options
author | Arun Isaac | 2022-07-06 01:04:16 +0530 |
---|---|---|
committer | Arun Isaac | 2022-07-06 01:04:16 +0530 |
commit | 170580827eae85cd6fb5e0b7e3947066780c8994 (patch) | |
tree | 3a11c425d463e05cc20e9618a3330eaca0ab70d5 | |
parent | f7fb006708dafd14162bfc81d28ec9a9a13b95cc (diff) | |
download | tissue-170580827eae85cd6fb5e0b7e3947066780c8994.tar.gz tissue-170580827eae85cd6fb5e0b7e3947066780c8994.tar.lz tissue-170580827eae85cd6fb5e0b7e3947066780c8994.zip |
bin: Look for a default config file.
* bin/tissue (%default-config-file): New variable.
(default-configuration): Read default config file if it exists.
-rwxr-xr-x | bin/tissue | 28 |
1 files changed, 17 insertions, 11 deletions
@@ -215,20 +215,26 @@ Export the repository as a website to OUTPUT-DIRECTORY. (string->number (substring listen (1+ (string-index-right listen #\:)))))))) +(define %default-config-file + "/etc/tissue.conf") + (define (default-configuration) "Return the default configuration options for the `tissue pull' and `tissue run-web' subcommands." - `((listen . "127.0.0.1:8080") - (state-directory . "/var/lib/tissue") - ;; Assume current repository as default. If there is no current - ;; repository, do not configure any hosts. - (hosts . ,(guard (c ((let ((git-error (condition-git-error c))) - (and git-error - (= (git-error-code git-error) - GIT_ENOTFOUND))) - '())) - `(("localhost" - (upstream-repository . ,(git-top-level)))))))) + (if (file-exists? %default-config-file) + (call-with-input-file %default-config-file + read) + `((listen . "127.0.0.1:8080") + (state-directory . "/var/lib/tissue") + ;; Assume current repository as default. If there is no current + ;; repository, do not configure any hosts. + (hosts . ,(guard (c ((let ((git-error (condition-git-error c))) + (and git-error + (= (git-error-code git-error) + GIT_ENOTFOUND))) + '())) + `(("localhost" + (upstream-repository . ,(git-top-level))))))))) (define tissue-run-web (match-lambda* |