forked from orthecreedence/wookie-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lisp
32 lines (24 loc) · 861 Bytes
/
init.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(in-package :wookie-doc)
(setf cl-who:*attribute-quote-char* #\"
(cl-who:html-mode) :html5)
;; load all enabled wookie plugins
(load-plugins :use-quicklisp t)
(defun error-handler (err &optional socket)
(unless (typep err 'as:tcp-info)
(format t "(wookie-doc) UNcaught error: ~a~%" err)))
(defun start (&key bind (port 8080))
;; setup the wookie log
(setf *log-level* :notice)
(setf *error-handler* 'error-handler)
;; load/cache all the views
(load-views)
;; start the server
(as:with-event-loop (:catch-app-errors t)
(let* ((listener (make-instance 'listener :bind bind :port port))
(server (start-server listener)))
(as:signal-handler 2
(lambda (sig)
(declare (ignore sig))
(as:free-signal-handler 2)
(as:close-tcp-server server)
(as:exit-event-loop))))))