summaryrefslogtreecommitdiff
path: root/src/dnd.lisp
diff options
context:
space:
mode:
authorGrant Shoshin Shangreaux <shoshin@cicadas.surf>2023-03-14 11:43:16 -0500
committerGrant Shoshin Shangreaux <shoshin@cicadas.surf>2023-03-14 11:43:16 -0500
commitdaa6f103c5fc5c473721a7b2bda16363ae39d391 (patch)
tree454413946bf7055d1906ca2061ed143ba36a0f7c /src/dnd.lisp
parent12662d6a0fceb0c2adfdc4d0947800994bc85718 (diff)
Add: configuration from file for datastore & lzb server
This defaults to looking for a file called config.lisp within the dnd system's directory. If you copy the config.lisp.example included in this commit out to simply config.lisp, then you should be able to run the (start) defun to get things running with "sane" defaults. It should create a datastore directory within the same system directory, which is also ignored by git.
Diffstat (limited to 'src/dnd.lisp')
-rw-r--r--src/dnd.lisp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/dnd.lisp b/src/dnd.lisp
index 952b8fe..70edd7d 100644
--- a/src/dnd.lisp
+++ b/src/dnd.lisp
@@ -2,16 +2,23 @@
(in-package #:dnd)
+(defvar *config* nil
+ "Instance of the config class globally available.")
+
(defvar *dnd-arena* nil
"The instance of the HTTP server")
-(defun start ()
- (init-db)
+(defun start (&optional config-path)
+ "Configures and initializes the datastore and web server, then starts the server."
+ (setf *config* (config-from-file (or config-path
+ (asdf:system-relative-pathname "dnd" "config.lisp"))))
+ (init-db *config*)
(setf *dnd-arena* (lzb:create-server))
(lzb:install-app *dnd-arena* (lzb:app 'dnd))
(lzb:start-server *dnd-arena*))
(defun boot ()
+ "Main entrypoint for an executable version of DND."
(swank:create-server :port 9876 :dont-close t)
(start)
(loop (sleep 1)))