With Play 1.2, I can prefix the configuration keys with the framework ID or application mode as follows:
# Production configuration
%prod.http.port=80
%prod.
If you want to be indepentent from restrited scala run modes you can use JVM properties. Put modified @coffesnake example to ./app/Global.scala :
import java.io.File
import play.api._
import com.typesafe.config.ConfigFactory
object Global extends GlobalSettings {
override def onLoadConfig(config: Configuration, path: File, classloader: ClassLoader, mode: Mode.Mode): Configuration = {
val environment = System.getProperty("environment")
val environmentSpecificConfig = config ++ Configuration(ConfigFactory.load(s"application.${environment}.conf"))
super.onLoadConfig(environmentSpecificConfig, path, classloader, mode)
}
}
Next run play play
and start app with environment param run -Denvironment=prod-server1
Don't join both command, it doesn't work then
Global configuration will be overrided with environment specific properties from file:
./conf/application.prod-server1.conf
EDIT:
From time perspective I saw this workaround is unnecessary. It is better to use Play build-in config loading mechanism
-Dconfig.file=/etc/play-application/foo-production.conf