Hello,
When I have a clojure file with the code as listed below , I get a
compilation error
when I run "lein compile" whenever the DATABASE_URL is not defined at
compile time.
However I would expect this would be evaluated at runtime.
Is this a bug, or more likely something I don't grasp, can someone
point it out for me?
(def db-url-re #".*://(.*):(.*)@(.*):(.*)/(.*)")
;; content store
;; we configureren onze database
(let [db-url (System/getenv "DATABASE_URL")
dbm (zipmap [:user :password :host :port :dbname] (next (first
(re-seq db-url-re db-url))))
db-host (:host dbm)
db-port (:port dbm)
db-name (:dbname dbm)
user (:user dbm)
pwd (:password dbm)]
(def db {:classname "org.postgresql.Driver" ; must be in
classpath
:subprotocol "postgresql"
:subname (str "//" db-host ":" db-port "/" db-name)
; Any additional keys are
passed to the driver
; as driver-specific
properties.
:user user
:password pwd
}))
Thanks,
PIeter
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en