We are migrating our application to Play Framework. We've been working with the gradle build system and are facing a couple of issues with sbt.
We use jooq for our database, which means that our build file needs to contain the database username/password (since jooq generates code by reading the db schema). Since it isn't a good idea, all the sensitive data is stored in a protected file on each host the build might potentially run on, and the build system reads from the file and then configures the system accordingly. It was pretty straightforward in gradle, but I have hit a deadend with sbt. This is what I have till now:
import org.json4s._
import org.json4s.native.JsonMethods.
val jsonBuildConfig = TaskKey[JValue]("json-build-config")
jsonBuildConfig := {
val confLines = scala.io.Source.fromFile("/etc/application.conf").mkString
parse(confLines)
}
jooqOptions := Seq(
"jdbc.driver" -> "org.postgresql.Driver",
"jdbc.url" -> "FIXME",
"jdbc.user" -> "FIXME",
"jdbc.password" -> "FIXME"
)
The problem is that the three configuration parameters, with FIXME
as their current values in jooqOptions
, need to be picked from the file.
Within jsonBuildConfig
, I can do this:
val confLines = scala.io.Source.fromFile("/etc/application.conf").mkString
val jsonConf = parse(confLines)
(jsonConf / "stagingdb" / "url").values
But how do I set it in jooqOptions
conf set?