diff options
author | Vincent Ambo <tazjin@gmail.com> | 2017-12-31T14·03+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@gmail.com> | 2017-12-31T14·31+0100 |
commit | bd3b2782b938a29d6952d7a06c040e59571d825e (patch) | |
tree | 04881f585bd90dcb12998e9672f08b0842544caa /src/gemma.lisp | |
parent | 8703b6102c348d5e860af83a980ba5e1585e3964 (diff) |
feat(lisp): Correctly set location for static assets in Nix builds
In order to let Hunchentoot serve the static assets from the correct location, the *static-file-location* parameter is set before image dumping based on the $out-envvar which is present during the build process. This can easily be set manually in the config file if required by a user.
Diffstat (limited to 'src/gemma.lisp')
-rw-r--r-- | src/gemma.lisp | 15 |
1 files changed, 12 insertions, 3 deletions
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 |