Setting configuration properties to access in REPL



package net

import com.typesafe.config.ConfigFactory

object Main extends App {
    override def main(args: Array[String]) {
        val bar   = ConfigFactory.load().getString("")
        val bippy = ConfigFactory.load().getString("app.bippy")
        println(s"bar: $bar | bippy : $bippy")


app {
    bar = ${?BAR}
    bippy = ${?BIPPY}

I attempted to set the BAR and BIPPY environment variables in sbt:

>set envVars := Map("BAR" -> "bar!", "BIPPY" -> "bippy!")

Then, I opened the REPL in test mode:


scala> import net.Main
import net.Main

scala> Main.main(Array())
com.typesafe.config.ConfigException$Missing: No configuration setting 
    found for key ''

How can I set these properties for the REPL?


Pass your configuration file using the -Dconfig.file system property

[localhost]$ sbt -Dconfig.file=src/test/resources/application.conf
[info] Loading global plugins from ~/.sbt/0.13/plugins
[info] Loading project definition from ~/my/project
[info] Set current project to my-project (in build file:~/my/project/)
> console
[info] Starting scala interpreter...
Welcome to Scala version 2.11.6 (OpenJDK 64-Bit Server VM, Java 1.8.0_72-internal).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import com.typesafe.config._
import com.typesafe.config._

scala> val config = ConfigFactory.load()
config: com.typesafe.config.Config = Config(SimpleConfigObject({"test": "success"})

scala> val value = config.getString("test")
value: String = test

Need Your Help

Apply class depending on media query screen size

css css3 twitter-bootstrap htmlbutton

I am using Twitter Bootstrap. I have a btn-group. I want the btn-group and btn-group-justified classes added for screens at or above 768px, and the btn-group-vertical class applied for screens at or

How do I setup a Doctrine relation for a foreign key that could point to different tables, depending on context?

php mysql database-design doctrine foreign-keys

I am creating an application, built with PHP, MySQL and Doctrine v1.2, that deals with ordered groupings of items, which can contain different types of items. For example, the group My Last Vacati...