summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-02-22 11:54:02 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-02-22 11:54:02 +0100
commit2504037a4b4e0db1eea0455dbe95f299a7784a8d (patch)
treeb1dbec4f39d59d663bb785cae313ec46754bed9d /src
parent3539550b9169817781ecdec9e8429fbef6b57b94 (diff)
Make mulk.benki.config/benki-config an atom.
Diffstat (limited to 'src')
-rw-r--r--src/mulk/benki/config.clj2
-rw-r--r--src/mulk/benki/db.clj6
-rw-r--r--src/mulk/benki/main.clj4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/mulk/benki/config.clj b/src/mulk/benki/config.clj
index 4b9493b..cd3c8b7 100644
--- a/src/mulk/benki/config.clj
+++ b/src/mulk/benki/config.clj
@@ -2,4 +2,4 @@
(:refer-clojure))
(def benki-config
- (read-string (slurp "config.sexp")))
+ (atom (read-string (slurp "config.sexp"))))
diff --git a/src/mulk/benki/db.clj b/src/mulk/benki/db.clj
index 61de478..343b09f 100644
--- a/src/mulk/benki/db.clj
+++ b/src/mulk/benki/db.clj
@@ -4,11 +4,11 @@
(:require [clojure.java.jdbc :as sql]))
-(def ^:private db
- (:database benki-config))
+(defn ^:private db []
+ (:database @benki-config))
(defn call-with-db [thunk]
- (sql/with-connection db
+ (sql/with-connection (db)
(thunk)))
(defmacro with-db [& body]
diff --git a/src/mulk/benki/main.clj b/src/mulk/benki/main.clj
index 2f4101f..09def98 100644
--- a/src/mulk/benki/main.clj
+++ b/src/mulk/benki/main.clj
@@ -22,7 +22,7 @@
(defn wrap-base-uri [handler]
(fn [request]
- (let [base-uri (:base-uri benki-config)]
+ (let [base-uri (:base-uri @benki-config)]
(hiccup.core/with-base-url base-uri
((noir.options/wrap-options handler {:base-url base-uri}) request)))))
@@ -31,7 +31,7 @@
(noir.server/add-middleware #(wrap-base-uri %))
(noir.server/add-middleware #(ring.middleware.file/wrap-file % "static")))
-(defonce server (doto (Thread. #(noir.server/start (:web-port benki-config)))
+(defonce server (doto (Thread. #(noir.server/start (:web-port @benki-config)))
(.setDaemon true)
(.start)))