40 lines
884 B
Common Lisp
40 lines
884 B
Common Lisp
|
(ql:quickload :www)
|
||
|
|
||
|
(defpackage www.app
|
||
|
(:use :cl)
|
||
|
(:import-from :lack.builder
|
||
|
:builder)
|
||
|
(:import-from :ppcre
|
||
|
:scan
|
||
|
:regex-replace)
|
||
|
(:import-from :www.web
|
||
|
:*web*)
|
||
|
(:import-from :www.config
|
||
|
:config
|
||
|
:productionp
|
||
|
:*static-directory*))
|
||
|
(in-package :www.app)
|
||
|
|
||
|
(builder
|
||
|
(:static
|
||
|
:path (lambda (path)
|
||
|
(if (ppcre:scan "^(?:/images/|/css/|/js/|/robot\\.txt$|/favicon\\.ico$)" path)
|
||
|
path
|
||
|
nil))
|
||
|
:root *static-directory*)
|
||
|
(if (productionp)
|
||
|
nil
|
||
|
:accesslog)
|
||
|
(if (getf (config) :error-log)
|
||
|
`(:backtrace
|
||
|
:output ,(getf (config) :error-log))
|
||
|
nil)
|
||
|
:session
|
||
|
(if (productionp)
|
||
|
nil
|
||
|
(lambda (app)
|
||
|
(lambda (env)
|
||
|
(let ((datafly:*trace-sql* t))
|
||
|
(funcall app env)))))
|
||
|
*web*)
|