I'm working on a Play library that's designed to plug into both the build process and the application code. I want the library to be centrally configured from the application's application.conf, and both the build-time and run-time parts need to access that configuration. At run-time, this is no problem; I just define a reference.conf with any defaults and use ConfigFactory.load, as usual.
However, I'm not sure what's best for build-time. I'm using the following in an SBT task:
import com.typesafe.config.ConfigFactory
val baseDir = baseDirectory.value
val config = ConfigFactory.parseFile(baseDir / "conf/application.conf")
, because ConfigFactory.load doesn't seem to work at build-time. But this strikes me as poor form, because it bypasses the normal logic of load. Is there a preferred way of doing this?