How to configure application.conf for an environment with Play 2.0?

I want to configure different application.conf files for each environment (test, stage, prod, etc.).

The documentation here indicates that this can be done by passing the -Dconfig.resource = parameter, for example:

play -Dconfig.resource = application.test.conf run

However, this does not work for me - no matter what value I entered, I still get my default configuration (application.conf). What am I doing wrong?

+4
source share
1 answer

Two possible workarounds for the problem encountered in config.resource:
1) You can override a specific property using the -D option on the command line, for example:

play -Ddb.default.url = "mysql: // myuser: mypassword @ localhost / dev" run

2) Overriding the configuration file works if you use the config.file property:

play -Dconfig.file = / conf / application.test.conf run

To do this, enter the full path to the configuration file, but at least it works.

+3
source

All Articles