How can I use Datomic Pro on Heroku?

风格不统一 提交于 2019-12-23 11:53:36

问题


I'd like to use Datomic Pro (Starter Edition, for now) on Heroku. But I don't want to commit my download key into Git. Instead, the right thing to do would seem to be store it in an environment variable. That means my project.clj now contains:

:dependencies [[org.clojure/clojure "1.5.1"]
               [com.datomic/datomic-pro "0.9.4707"]]
:repositories {"my.datomic.com" {:url "https://my.datomic.com/repo"
                                 :username ~(System/getenv "DATOMIC_EMAIL")
                                 :password ~(System/getenv "DATOMIC_KEY")}}

I've set DATOMIC_EMAIL and DATOMIC_KEY in the Heroku app's config. Turns out that doesn't matter, because the project.clj is processed during the build phase, without access to the environment variables.

Now that the user-env-compile feature no longer exists, how can I get Datomic running on Heroku?

(I could fork the buildpack and force the environment variables to be used during the build phase, but I'd rather avoid going that far if I can.)


回答1:


I think you no longer need to fork the buildpack. Heroku recently made changes to their buildpack API that allow buildpacks to see environment vars that you've set for your app.

As described in Clojure buildpack's README, you need to set BUILD_CONFIG_WHITELIST var to something like this: DATOMIC_EMAIL DATOMIC_KEY and also, of course, set DATOMIC_EMAIL and DATOMIC_KEY vars accordingly.

Hope this helps.



来源:https://stackoverflow.com/questions/23413176/how-can-i-use-datomic-pro-on-heroku

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!