From c8ad02cd2f35f627e4d0f94cc814c06689643100 Mon Sep 17 00:00:00 2001 From: not manx Date: Mon, 6 Jul 2020 23:28:45 +0000 Subject: [PATCH] https://www.youtube.com/watch?v=hzPpWInAiOg --- hunchenhelpers.asd | 6 +++--- main.lisp | 10 +++++++++- package.lisp | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/hunchenhelpers.asd b/hunchenhelpers.asd index 0a85e79..49ff7eb 100644 --- a/hunchenhelpers.asd +++ b/hunchenhelpers.asd @@ -1,8 +1,8 @@ (asdf:defsystem #:hunchenhelpers :description "A helper library for hunchentoot" - :author "Manx (boku@plum.moe)" - :license "X11/MIT" - :version "1.0.0" + :author "Manx " + :license "GPLv3" + :version "1.1.0" :serial t :depends-on (:hunchentoot) :Components ((:file "package") diff --git a/main.lisp b/main.lisp index 0fb4eb7..36ee05d 100644 --- a/main.lisp +++ b/main.lisp @@ -18,6 +18,13 @@ (defun host-dir (uri path &optional content-type) (hunchenhost tbnl:create-folder-dispatcher-and-handler uri path content-type)) +(defmacro config-item (thing &aux (item (gensym))) + "Get `thing' from the alist `config', error if it doesn't exist" + `(let ((,item (assoc ,thing (eval (read-from-string "config"))))) + (when (atom ,item) + (error "No such config item")) + (cdr ,item))) + ;; Stolen from stackoverflow (defmacro method-path (methods path) "Expands to a predicate the returns true of the Hunchtoot request @@ -60,4 +67,5 @@ handler. (export '(host-file host-dir handle - acceptor)) + acceptor + config-item)) diff --git a/package.lisp b/package.lisp index b2af120..6a3f742 100644 --- a/package.lisp +++ b/package.lisp @@ -1,3 +1,3 @@ (defpackage #:hunchenhelpers - (:nicknames :henh) + (:nicknames #:toot) (:use #:cl))