Search code examples
scalaplayframeworkplayframework-2.2

Play 2.2.4 externalized config file


According to the documentation an application build with the task play dist should be able to be externalized configured using -Dconfig.file=c:\conf\application.prod.conf but whatever i do the -Dconfig.file option seems to have totally no effect and the default application.conf inside the packaged jar seems to be loaded.

Any clue on how to use the externalized config in a Play 2.2.4 application?


Solution

  • At Heroku we use an environment variable to determine which config to use. Like this:

    web: target/universal/stage/bin/theapp -Dhttp.port=${PORT} -Dconfig.resource=${ENVIRONMENT}.conf ${JAVA_OPTS}

    Locally I guess you could run it like this (note the quotes!):

    $ activator "run -Dconfig.file=/Users/durre/conf/application.conf"
    

    Maybe replace "activator" with "play". I forgot when they switched to activator.