ui: serve: Respect site configuration and default options.
* haunt/ui/serve.scm (%default-options): Fix alist. (haunt-serve): Use site config file to determine web server root.
This commit is contained in:
parent
33d7c84e88
commit
46d38aab9d
|
@ -27,6 +27,7 @@
|
|||
#:use-module (srfi srfi-37)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 format)
|
||||
#:use-module (haunt site)
|
||||
#:use-module (haunt config)
|
||||
#:use-module (haunt ui)
|
||||
#:use-module (haunt serve web-server)
|
||||
|
@ -60,11 +61,13 @@ Start an HTTP server for the current site.~%")
|
|||
%common-options))
|
||||
|
||||
(define %default-options
|
||||
(cons '((port . 8080))
|
||||
(cons '(port . 8080)
|
||||
%default-common-options))
|
||||
|
||||
(define (haunt-serve . args)
|
||||
(let* ((opts (simple-args-fold args %options %default-options))
|
||||
(port (assoc-ref opts 'port)))
|
||||
(format #t "serving ~a on port ~d~%" (haunt-output-directory) port)
|
||||
(serve (haunt-output-directory))))
|
||||
(port (assq-ref opts 'port))
|
||||
(site (load-config (assq-ref opts 'config)))
|
||||
(doc-root (site-build-directory site)))
|
||||
(format #t "serving ~a on port ~d~%" doc-root port)
|
||||
(serve doc-root)))
|
||||
|
|
Loading…
Reference in New Issue