summaryrefslogtreecommitdiff
path: root/src/dnd.lisp
blob: 70edd7d860f076910a21c320e08aef2de4455794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
;;;; dnd.lisp

(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 (&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)))