gitile.in
1 | #!@GUILE@ \ |
2 | --no-auto-compile -e main -s |
3 | !# |
4 | |
5 | ;;;; Copyright (C) 2020 Julien Lepiller <julien@lepiller.eu> |
6 | ;;;; Copyright (C) 2024 Evgeny Pisemsky <mail@pisemsky.site> |
7 | ;;;; |
8 | ;;;; SPDX-License-Identifier: AGPL-3.0-or-later |
9 | ;;;; |
10 | ;;;; This program is free software: you can redistribute it and/or modify |
11 | ;;;; it under the terms of the GNU Affero General Public License as published by |
12 | ;;;; the Free Software Foundation, either version 3 of the License, or |
13 | ;;;; (at your option) any later version. |
14 | ;;;; |
15 | ;;;; This program is distributed in the hope that it will be useful, |
16 | ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | ;;;; GNU Affero General Public License for more details. |
19 | ;;;; |
20 | ;;;; You should have received a copy of the GNU Affero General Public License |
21 | ;;;; along with this program. If not, see <https://www.gnu.org/licenses/>. |
22 | ;;;; |
23 | |
24 | (use-modules (ice-9 match) |
25 | (fibers web server) |
26 | (git settings) |
27 | (gitile config) |
28 | (gitile handler)) |
29 | |
30 | (define* (main #:optional (args (command-line))) |
31 | (let ((config |
32 | (match args |
33 | ((_ "-c" file) |
34 | (let ((content (call-with-input-file file read))) |
35 | (match content |
36 | (('config ('port port) |
37 | ('host host) |
38 | ('database database) |
39 | ('repositories repositories) |
40 | ('base-git-url git-base-url) |
41 | ('index-title index-title) |
42 | ('intro intro) |
43 | ('footer footer)) |
44 | (make-config port host database repositories |
45 | git-base-url index-title intro footer))))) |
46 | (_ (format #t "Usage: ~a -c config-file~%" (car args)) |
47 | (exit))))) |
48 | (set-owner-validation! #f) |
49 | (set-parameters-from-config! config) |
50 | (run-server (gitile-handler config) #:port (config-port config)))) |
51 | |
52 | ;; Local Variables: |
53 | ;; mode: scheme |
54 | ;; End: |
55 |