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