diff options
-rwxr-xr-x | bin/tissue | 3 | ||||
-rw-r--r-- | tissue/web/dev.scm | 15 |
2 files changed, 9 insertions, 9 deletions
@@ -310,8 +310,7 @@ Serve website and issues of current repository. (when (assq-ref args 'listen-repl) (start-repl (assq-ref args 'listen-repl))) (start-dev-web-server (assq-ref args 'port) - %xapian-index - (load-config)))))) + %xapian-index load-config))))) (define (print-usage) (format #t "Usage: ~a COMMAND [OPTIONS] [ARGS] diff --git a/tissue/web/dev.scm b/tissue/web/dev.scm index 7f29be6..2be978c 100644 --- a/tissue/web/dev.scm +++ b/tissue/web/dev.scm @@ -32,11 +32,12 @@ #:use-module (tissue web static) #:export (start-dev-web-server)) -(define (handler request body xapian-index project) +(define (handler request body xapian-index project-thunk) "Handle web @var{request} with @var{body} and return two values---the response headers and body. See @code{start-dev-web-server} for -documentation of @var{xapian-index} and @var{project}." - (let ((path (uri-path (request-uri request)))) +documentation of @var{xapian-index} and @var{project-thunk}." + (let ((project (project-thunk)) + (path (uri-path (request-uri request)))) (log-request request) (cond ;; Search page @@ -63,17 +64,17 @@ documentation of @var{xapian-index} and @var{project}." (else (404-response request))))) -(define (start-dev-web-server port xapian-index project) +(define (start-dev-web-server port xapian-index project-thunk) "Start development web server listening on @var{port}. @var{xapian-index} is the path to the Xapian index to -search in. @var{project} is a @code{<tissue-configuration>} object -describing the project." +search in. @var{project} is a thunk that returns a +@code{<tissue-configuration>} object describing the project." (format (current-error-port) "Tissue development web server listening at http://localhost:~a~%" port) ;; Explicitly dereference the module and handler variable each time ;; so as to support live hacking. (run-server (cut (module-ref (resolve-module '(tissue web dev)) 'handler) - <> <> xapian-index project) + <> <> xapian-index project-thunk) 'http (list #:port port))) |