summaryrefslogtreecommitdiff
path: root/tissue
diff options
context:
space:
mode:
authorArun Isaac2022-12-24 23:53:09 +0000
committerArun Isaac2022-12-25 23:33:04 +0000
commit3ff858a5fd78ee4b93af129149430bbd1b39a583 (patch)
tree51bdc434fc81e870b71c0091ee6aa2cb1d7a3e02 /tissue
parent6858a6b3d1236bbffaf32376699c3e193ffad324 (diff)
downloadtissue-3ff858a5fd78ee4b93af129149430bbd1b39a583.tar.gz
tissue-3ff858a5fd78ee4b93af129149430bbd1b39a583.tar.lz
tissue-3ff858a5fd78ee4b93af129149430bbd1b39a583.zip
web: dev: Accept thunk to read project configuration.
To the development server, pass a thunk to read project configuration instead of the project configuration itself. This allows us to hack on the project's tissue.scm without having to restart the development server to see changes. * bin/tissue (tissue-web-dev): Pass thunk to read project configuration instead of the project configuration itself. * tissue/web/dev.scm (handler, start-dev-web-server): Accept thunk to read project configuration instead of the project configuration itself.
Diffstat (limited to 'tissue')
-rw-r--r--tissue/web/dev.scm15
1 files changed, 8 insertions, 7 deletions
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)))