summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-04-11 17:48:19 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-04-11 17:48:19 -0400
commit46d38aab9dc96cb531d6150ae6cf43bbf3b47711 (patch)
tree5bf8608beacfc075ab79f442813f5cb18d3fe13a
parent33d7c84e882704b7afd081dce9e7f515bd6f7dc2 (diff)
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.
-rw-r--r--haunt/ui/serve.scm11
1 files changed, 7 insertions, 4 deletions
diff --git a/haunt/ui/serve.scm b/haunt/ui/serve.scm
index 6e58a31..09bcfcc 100644
--- a/haunt/ui/serve.scm
+++ b/haunt/ui/serve.scm
@@ -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)))