From 772d1b6c8a615a3ed1b5e1293127c8d4c31aed8f Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 21 Jul 2022 00:25:14 +0530 Subject: web: server: Be unaware of the state directory. The server should be unaware of the specifics of the state directory and its directory structure. It should be explicitly passed paths to all necessary directories. This way, the server can be repurposed for other applications such as the development web server---something that is coming soon in the subsequent commits. * tissue/web/server.scm (handler): Remove state-directory argument. Use directory paths in hosts argument. (start-web-server): Remove state-directory argument. Do not pass on state-directory to handler. * bin/tissue (tissue-web): Pass directory paths explicitly to start-web-server in hosts argument. Do not pass the removed state-directory argument. --- bin/tissue | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'bin') diff --git a/bin/tissue b/bin/tissue index 98073cb..30cad46 100755 --- a/bin/tissue +++ b/bin/tissue @@ -256,17 +256,21 @@ Serve repositories specified in CONFIG-FILE over HTTP. (start-web-server (listen->socket-address (assq-ref args 'listen)) (map (match-lambda ((name parameters ...) - ;; Set CSS for each host. - (parameterize ((%current-git-repository - (repository-open - (string-append (assq-ref args 'state-directory) - "/" name "/repository")))) - (cons name - (acons 'css - (tissue-configuration-web-css (load-config)) - parameters))))) - (assq-ref args 'hosts)) - (assq-ref args 'state-directory)))))) + ;; Add CSS, repository directory, + ;; website directory, xapian + ;; directory settings for each host. + (let* ((state-directory (assq-ref args 'state-directory)) + (repository-directory + (string-append state-directory "/" name "/repository"))) + (parameterize ((%current-git-repository + (repository-open repository-directory))) + (cons name + `((css . ,(tissue-configuration-web-css (load-config))) + (repository-directory . ,repository-directory) + (website-directory . ,(string-append state-directory "/" name "/website")) + (xapian-directory . ,(string-append state-directory "/" name "/xapian")) + ,@parameters)))))) + (assq-ref args 'hosts))))))) ;; This is a noop, since the index is built on any tissue command. It ;; exists just for the --help usage summary. -- cgit v1.2.3