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