Given the following "Main" app:
package net
import com.typesafe.config.ConfigFactory
object Main extends App {
override def main(args: Array[String]) {
val x = ConfigFactory.load().getString("app.bar")
println(s"x: $x")
}
}
and application.conf
:
app {
bar = ${?BAR}
}
I could pass in the command-line argument via:
$sbt test:run -DBAR=bippy
[info] Set current project to typesafe_config_env_var
(in build file:.../typesafe_config_env_var/)
[info] Running net.Main
x: bippy
I wrote this simple example to try to reproduce a problem resolving a command-line argument. However, as the output above shows, this test worked successfully.
Is this the standard way of passing command-line arguments in sbt?