From 76ae43160acb849fe467e20677aa9d84e59160ef Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Thu, 5 Sep 2024 18:10:14 -0700 Subject: [PATCH] Add a prefix option to web app --- web.lisp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/web.lisp b/web.lisp index ae19588..cdb1a87 100644 --- a/web.lisp +++ b/web.lisp @@ -36,6 +36,7 @@ (defparameter *default-port* 8000) (defparameter *default-address* "127.0.0.1") +(defparameter *default-prefix* "/") (defwidget truth-table () ((data :initform nil @@ -297,7 +298,11 @@ reblocks bug.") (#\p "port" port t ,(format nil "specify port to use (default: ~d)" *default-port*)) (#\a "address" address t - ,(format nil "specify address to bind to (default: ~a)" *default-address*))) + ,(format nil "specify address to bind to (default: ~a)" + *default-address*)) + (#\x "prefix" prefix t + ,(format nil "specify the URL prefix (default: ~a)" + *default-prefix*))) "Spec for use in `parse-command-line.") (defun determine-port (opts) @@ -342,10 +347,14 @@ arguments." (uiop:quit 0))) (when cmdline-error (uiop:quit 1)) + (defapp truth-table-app + :prefix (or (option-value 'prefix opts) + *default-prefix*)) (reblocks/server:start :apps '(truth-table-app) :port port :interface address - :debug (option-value 'debug opts))))))) + :debug (option-value 'debug opts) + :disable-welcome-app t)))))) (defun toplevel () "Top-level function to be passed to `save-lisp-and-die'."