diff options
-rw-r--r-- | build.lisp | 6 | ||||
-rw-r--r-- | src/gemma.lisp | 15 |
2 files changed, 12 insertions, 9 deletions
diff --git a/build.lisp b/build.lisp index 3c8ce3372177..ce67a91f6585 100644 --- a/build.lisp +++ b/build.lisp @@ -28,10 +28,4 @@ ;; cl-prevalence is not in the current Quicklisp -> Nix snapshot (ql:quickload "cl-prevalence") -;; the $out path should be set in the application to let Hunchentoot serve the -;; correct static files. - -(if (sb-posix:getenv "out") - (defvar *gemma-nix-out-dir* (sb-posix:getenv "out"))) - (asdf:operate 'asdf:program-op :gemma) diff --git a/src/gemma.lisp b/src/gemma.lisp index 526eb0453549..b8a20addd907 100644 --- a/src/gemma.lisp +++ b/src/gemma.lisp @@ -29,6 +29,14 @@ (defvar *gemma-port* 4242 "Port on which the Gemma web server listens.") +(defvar *static-file-location* + (or (in-case-of (sb-posix:getenv "out") + (concatenate 'string it "/share/gemma/")) + "frontend/") + "Folder from which to serve static assets. If built inside of Nix, + the folder is concatenated with the output path at which the files + are expected to be.") + (defun initialise-persistence (data-dir) (defvar *p-tasks* (cl-prevalence:make-prevalence-system data-dir) @@ -129,9 +137,10 @@ maximum interval." "/etc/gemma/config.lisp"))) ;; Set up web server - (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port *gemma-port*)) - - ;; ... and register all handlers. + (hunchentoot:start + (make-instance 'hunchentoot:easy-acceptor + :port *gemma-port* + :document-root *static-file-location*)) ;; Task listing handler (hunchentoot:define-easy-handler |