58b9a364262f1d92ad97ec3b85981d1e367b31e9
[software/mumi.git] / mumi / config.scm.in
1 ;;; mumi -- Mediocre, uh, mail interface
2 ;;; Copyright © 2017, 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
3 ;;;
4 ;;; This program is free software: you can redistribute it and/or
5 ;;; modify it under the terms of the GNU Affero General Public License
6 ;;; as published by the Free Software Foundation, either version 3 of
7 ;;; the License, or (at your option) any later version.
8 ;;;
9 ;;; This program is distributed in the hope that it will be useful,
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ;;; Affero General Public License for more details.
13 ;;;
14 ;;; You should have received a copy of the GNU Affero General Public
15 ;;; License along with this program. If not, see
16 ;;; <http://www.gnu.org/licenses/>.
17
18 (define-module (mumi config)
19 #:use-module (debbugs)
20 #:export (%config
21 mailer-enabled?))
22
23 (define mailer-enabled?
24 (make-parameter #t))
25
26 (define %config
27 (let ((config
28 ;; Try to find the "assets" directory relative to the executable
29 ;; first. This is useful when using "pre-inst-env".
30 `((assets-dir . ,(let ((maybe-dir
31 (string-append (getcwd) "/assets")))
32 (if (and (getenv "MUMI_UNINSTALLED")
33 (file-exists? maybe-dir))
34 maybe-dir
35 ;; TODO: use @assetsdir@ variable here
36 "@prefix@/share/mumi/assets")))
37 (pkg-dir . ,(let ((maybe-dir
38 (string-append (getcwd) "/etc")))
39 (if (and (getenv "MUMI_UNINSTALLED")
40 (file-exists? maybe-dir))
41 maybe-dir
42 (let ((dir "@datarootdir@/mumi"))
43 (if (string-prefix? "${prefix}" dir)
44 (string-replace dir "@prefix@"
45 0 (string-length "${prefix}"))
46 dir)))))
47 (db-dir . ,(let ((maybe-dir (getcwd)))
48 (if (and (getenv "MUMI_UNINSTALLED")
49 (file-exists? maybe-dir))
50 maybe-dir
51 (let ((dir "@localstatedir@/mumi/db"))
52 (if (string-prefix? "${prefix}" dir)
53 (string-replace dir "@prefix@"
54 0 (string-length "${prefix}"))
55 dir)))))
56 (key-dir . ,(let ((maybe-dir (getcwd)))
57 (if (and (getenv "MUMI_UNINSTALLED")
58 (file-exists? maybe-dir))
59 maybe-dir
60 (let ((dir "@localstatedir@/mumi/"))
61 (if (string-prefix? "${prefix}" dir)
62 (string-replace dir "@prefix@"
63 0 (string-length "${prefix}"))
64 dir)))))
65 (data-dir . ,(let ((maybe-dir
66 (string-append (getcwd) "/data")))
67 (if (and (getenv "MUMI_UNINSTALLED")
68 (file-exists? maybe-dir))
69 maybe-dir
70 (let ((dir "@localstatedir@/mumi/data"))
71 (if (string-prefix? "${prefix}" dir)
72 (string-replace dir "@prefix@"
73 0 (string-length "${prefix}"))
74 dir)))))
75 (host . "localhost")
76 (port . 1234)
77 (cache-ttl . 120)
78 (submission-email-address . "guix-patches@gnu.org")
79 (submission-bug-email-address . "bug-guix@gnu.org")
80 (lists . ("guix-patches@gnu.org" "bug-guix@gnu.org"))
81 (packages . ("guix-patches" "guix"))
82 (debbugs . ,%gnu)
83 (debbugs-domain . "debbugs.gnu.org"))))
84 (lambda (key)
85 (assoc-ref config key))))