;;;; init.lisp (in-package #:dnd) ;;; CONFIGURATION (defvar *config* nil "Instance of the config class globally available.") (defclass/std config () ((datastore-directory :ir :std #P"/srv/dnd/store/") (swank-port :std nil :doc "If set, swank is started on this port.") (host :std "0.0.0.0") (port :ir :std 8888))) (defun config-from-file (path) "PATH should be a path to a file containing a PLIST suitable for passing as the keyword arguments to (MAKE-INSTANCE 'CONFIG ...)" (apply #'make-instance 'config (read-from-file path))) ;;; DATASTORE (defun init-db (config) "Initializes the data store with values from the CONFIG." (ensure-directories-exist (datastore-directory config)) (unless (boundp 'db:*store*) (make-instance 'db:mp-store :directory (datastore-directory config) :subsystems (list (make-instance 'db:store-object-subsystem)))))