diff options
author | Colin Okay <colin@cicadas.surf> | 2022-10-15 11:28:16 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-10-15 11:28:16 -0500 |
commit | fee73c9f8ed2213d22df12f2a407639764079d60 (patch) | |
tree | b40d06c8d1dafe1e5540897b67a42b0dbee4e22e | |
parent | f71bb13927b20a6e6211eee6299ea1b3627bacf3 (diff) |
Add: app-dict
-rw-r--r-- | lazybones.lisp | 14 | ||||
-rw-r--r-- | package.lisp | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/lazybones.lisp b/lazybones.lisp index 5bdd7e6..d15af33 100644 --- a/lazybones.lisp +++ b/lazybones.lisp @@ -105,7 +105,11 @@ :documentation "Default content type sent back to clients.") (endpoints :accessor app-endpoints - :initform nil))) + :initform nil) + (dict + :accessor app-dict + :initform (make-hash-table :test 'equal) + :documentation "A hash table for storing arbitrary informatrion on this application."))) (defun expand-provision-app-option (app option value) (list 'setf @@ -144,6 +148,14 @@ supplied, get the default app. Every package has at most one default app, named with the package name. If no app can be found, return NIL" (symbol-lazybones (or name (default-app-name)) nil)) +(defun app-dict (key &optional name) + "Get value from the application dict" + (gethash key (app-dict (app name)))) + +(defun (setf app-dict) (new key &optional name) + "Set a value in the application dict." + (setf (gethash key (app-dict (app name))) new)) + (defclass endpoint () ((method :reader endpoint-method diff --git a/package.lisp b/package.lisp index 6e57492..8c65afd 100644 --- a/package.lisp +++ b/package.lisp @@ -81,5 +81,6 @@ #:set-definition #:drop-definition #:add-class-to-definitions - #:ext->mimetype)) + #:ext->mimetype + #:app-dict)) |