How to set up different databases per environment in Play 2.0?

后端 未结 5 1831
没有蜡笔的小新
没有蜡笔的小新 2020-12-08 03:02

I\'d like my Play app to use different databases for test, local and production (production is Heroku) environments.

In application.conf I have:

<
5条回答
  •  情话喂你
    2020-12-08 03:29

    In Play 2 there aren't different config environments. Instead you just set or override the config parameters in the conf/application.conf file. One way to do it is on the play command line, like:

    play -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=$DATABASE_URL ~run
    

    You can also tell Play to use a different config file:

    play -Dconfig.file=conf/prod.conf ~run
    

    For an example Procfile for Heroku, see:
    https://github.com/jamesward/play2bars/blob/scala-anorm/Procfile

    More details in the Play Docs:
    http://www.playframework.org/documentation/2.0/Configuration

提交回复
热议问题