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.
This commit is contained in:
parent
8703b6102c
commit
bd3b2782b9
2 changed files with 12 additions and 9 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue