If i'm using Java, I can set custom application.properties
location with something like this:
@PropertySources({
@PropertySource(value = "file:${APP_CONF_DIR}/application.properties", ignoreResourceNotFound = true)
})
Is there any way to do the same thing in Scala without using "-Dbla.bla=app.config"
on application start
The behavior of Lightbend Config around loading application.conf
is mostly from ConfigFactory.load()
, which will look for application.conf
or the file/resource given by Java properties (the -Dconfig.file
and friends in your question).
If not interested in setting the alternative to application.conf
through Java properties, one can load a different resource from the classpath with ConfigFactory.load("foo")
to load foo.conf
. Alternatively if one is loading a file, one can use ConfigFactory.load(ConfigFactory.parseFile(file))
, where file
is a java.io.File
.