Reputation: 169
I'm developing a migration script using Scala for one of my Play projects. This script makes use of the libraries in the Play project, so it resides in the project path. I use 'play console' to execute the script and it works well.
However, I can't figure out how to retrieve settings from the application.conf there. play.api.Play.current.configuration throws an error 'java.lang.RuntimeException: There is no started application'.
Any suggestion of how to get the settings using another method?
Upvotes: 0
Views: 119
Reputation: 7247
You could just use the underlying config library:
import com.typesafe.config._
val config = ConfigFactory.load()
Or you could start a Play application:
import play.core.StaticApplication
new StaticApplication(new java.io.File("."))
play.api.Play.current.configuration.get(...)
Upvotes: 1