我刚刚创建了一个Luminus应用程序,它有两个独立的地方定义了数据库访问。在ragtime的project.clj中:
:ragtime {:migrations ragtime.sql.files/migrations
:database "jdbc:postgresql://localhost/foobar?user=db_user_name_here&password=db_user_password_here"}在src/foobar/db/core.clj中:
(def db-spec
{:subprotocol "postgresql"
:subname "//localhost/foobar"
:user "db_user_name_here"
:password "db_user_password_here"})有没有人写过代码来分解Heroku提供的DATABASE_URL,或者以某种方式将其用于连接?当然,我不是第一个想这样做的人,对吧?
此外,在这个过程中,如果有单独的开发和生产证书就更好了。
发布于 2015-06-23 02:06:31
如果ragtime正在使用clojure.java.jdbc (我相信它是),那么您应该能够直接将DATABASE_URL传递给它。有点像:
(def spec (or (System/getenv "DATABASE_URL") "postgresql://localhost:5432/shouter"))有关更多示例,请参阅Heroku Dev Center和Getting Started guides。
https://stackoverflow.com/questions/30984282
复制相似问题