From 22acc50a5aa38b20c13a5fa650c7988d4cb2a677 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Mon, 25 Jun 2012 21:23:55 +0200 Subject: Load service namespaces lazily. --- src/mulk/benki/main.clj | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mulk/benki/main.clj b/src/mulk/benki/main.clj index 354358a..bf15e1f 100644 --- a/src/mulk/benki/main.clj +++ b/src/mulk/benki/main.clj @@ -3,11 +3,11 @@ (:use [clojure core repl pprint] noir.core [hiccup core page] - [mulk.benki util config db]) + [mulk.benki config db util]) (:require [noir.core] [noir server options] - [mulk.benki wiki auth book_marx id lazychat xmpp genkey] [ring.middleware.file] + [ring.middleware.file-info] [noir.session :as session] [noir.request :as request] [clojure.java.jdbc :as sql] @@ -114,6 +114,7 @@ response)))) (do-once ::init + (noir.server/add-middleware #(ring.middleware.file-info/wrap-file-info %)) (noir.server/add-middleware #(hiccup.middleware/wrap-base-url % (:base-uri @benki-config))) (noir.server/add-middleware #(wrap-missing-status-code %)) (noir.server/add-middleware #(wrap-utf-8 %)) @@ -140,9 +141,12 @@ (defn -main [& args] (do + (noir.server/load-views-ns 'mulk.benki) (init-security!) - (future (mulk.benki.xmpp/init-xmpp!)) - (future (mulk.benki.lazychat/init-lazychat!)) + (future (require 'mulk.benki.xmpp) + ((ns-resolve 'mulk.benki.xmpp 'init-xmpp!))) + (future (require 'mulk.benki.lazychat) + ((ns-resolve 'mulk.benki.lazychat 'init-lazychat!))) (future (swap! server (run-server)))) (loop [] (Thread/sleep 1000000) -- cgit v1.2.3