Permalink
Browse files

Work around Korma bug #62 for URL-style DB parameters.

  • Loading branch information...
1 parent a9d4678 commit 937b495a7366ea5f37f8b3d1557432801434116d @technomancy committed May 17, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/clojars/config.clj
View
@@ -2,9 +2,8 @@
(:require [clojure.tools.cli :refer [cli]]
[clojure.java.io :as io]
[clojure.string :as str]
- [ring.util.codec :as codec]))
-
-(def config (when-not *compile-files* (read-string (slurp (io/resource "config.clj")))))
+ [ring.util.codec :as codec]
+ [korma.db]))
(def default-config
{:port 8080
@@ -102,6 +101,8 @@
(merge env-opts arg-opts))]
[opts args banner]))
+(def config (when-not *compile-files* (parse-resource "config.clj")))
+
(defn configure [args]
(let [[options args banner] (parse-config args)]
(when (:help options)
@@ -115,4 +116,11 @@
(println "Some options can be set using these environment variables:")
(println (str/join " " (map first env-vars)))
(System/exit 0))
- (alter-var-root #'config (fn [_] options))))
+ (alter-var-root #'config (fn [_] options))
+
+ ;; TODO: this is gross because Korma breaks when the DB connection
+ ;; parameter is a string; see https://github.com/ibdknox/Korma/issues/62
+ (korma.db/default-connection (:db config))
+ (korma.config/merge-defaults {:delimiters ["\"" "\""]
+ :naming {:fields identity
+ :keys identity}})))

0 comments on commit 937b495

Please sign in to comment.