Read a configuration file, permitting some predefined sections to be added to the configuration before it is read.
Read a configuration file, permitting some predefined sections to be added to the configuration before it is read. The predefined sections are defined in a map of maps. The outer map is keyed by predefined section name. The inner maps consist of options and their values. For instance, to read a configuration file, giving it access to certain command line parameters, you could do something like this:
object Foo {
def main(args: Array[String]) = {
// You'd obviously want to do some real argument checking here.
val configFile = args(0)
val name = args(1)
val ipAddress = args(2)
val sections = Map("args" -> Map("name" -> name, "ip" -> ipAddress))
val config = Configuration(configFile, sections)
...
}
}
scala.io.Source object to read
the predefined sections. An empty map means there are no predefined sections.
the Configuration object.
Use the Configuration object
Read a configuration.
Read a configuration.
scala.io.Source object to read
the Configuration object.
Use the Configuration object
A configuration reader: Reads a source and produces a parsed configuration.