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

后端 未结 5 1833
没有蜡笔的小新
没有蜡笔的小新 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:36

    There is another approach which is to override Global / GlobalSettings method onLoadConfig and from there you can setup application configuration with generic config and specific environment configuration like below...

    conf/application.conf --> configurations common for all environment
    conf/dev/application.conf --> configurations for development environment
    conf/test/application.conf --> configurations for testing environment
    
    conf/prod/application.conf --> configurations for production environment
    

    You can check http://bit.ly/1AiZvX5 for my sample implementation.

    Hope this helps.

提交回复
热议问题