Play framework 2 development configuration

2019-03-27 08:56发布

How I can setup different configuration for development and production mode in Play 2 application?

I've try to use JVM arguments on application start in development mode like this:

play "run -Dconfig.resource=dev.conf"

or from Play console:

run -Dconfig.resource=dev.conf

but it did not work.

2条回答
Lonely孤独者°
2楼-- · 2019-03-27 09:04

That should work:

play -Dconfig.resource=dev.conf "run"

Anyway I had some problems with -Dconfig.resource so I'm using -Dconfig.file instead

play -Dconfig.file=/full/path/to/your/project_folder/conf/alt_conf.conf "run"
查看更多
Evening l夕情丶
3楼-- · 2019-03-27 09:06

Even better would be to use the standard application.conf file for you development file and use a specific file for your other environments.

Then, using @Biesior's suggestion, you can use in dev :

play start 

And for the other environments, Heroku for example, use the other files :

play start -Dconfig.file=conf/application.heroku.conf
查看更多
登录 后发表回答