Test Scala Config
This is a sample project to demonstrate how to use a "multi-environment" configuration setup for Scala with TypeSafe’s Config library.
See this Stack Overflow thread for more info.
Requirements
-
Scala 2.11
-
SBT 0.13
Configuration files
-
the PROD configuration (note that the DEV is in included, so you only have to override what you want)
Running in DEV environment
The DEV environment is the default one, just start an SBT session and run
the main program.
Running in PROD environment
Simply specify the TypeSafe configuration file to use by passing the config.resource
system property (documented here).
This can be done either by passing the system property when starting the SBT session sbt -Dconfig.resource=prod.conf
or by editing the build.sbt
file and adding/uncommenting these lines:
fork := true javaOptions := Seq("-Dconfig.resource=prod.conf")