summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorArun Isaac2022-07-06 01:04:16 +0530
committerArun Isaac2022-07-06 01:04:16 +0530
commit170580827eae85cd6fb5e0b7e3947066780c8994 (patch)
tree3a11c425d463e05cc20e9618a3330eaca0ab70d5 /bin
parentf7fb006708dafd14162bfc81d28ec9a9a13b95cc (diff)
downloadtissue-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.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tissue28
1 files changed, 17 insertions, 11 deletions
diff --git a/bin/tissue b/bin/tissue
index 7b2c154..e047929 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -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*