From 46d38aab9dc96cb531d6150ae6cf43bbf3b47711 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 11 Apr 2015 17:48:19 -0400 Subject: 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. --- haunt/ui/serve.scm | 11 +++++++---- 1 file 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))) -- cgit v1.2.3