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(Source.fromFile(new File(configFile)), sections) ... } }
scala.io.Source object to read
the predefined sections. An empty map means there are no predefined sections.
Whether an exception should be thrown for bad
variable substitutions (false) or
not (true). Default: false
Regular expression that matches legal section names.
Regular expression that matches comment lines.
the Configuration object.
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(Source.fromFile(new File(configFile)), sections) ... } }
scala.io.Source object to read
the predefined sections. An empty map means there are no predefined sections.
the Configuration object.
Read a configuration file.
Read a configuration file.
scala.io.Source object to read
Whether an exception should be thrown for bad
variable substitutions (false) or
not (true). Default: false
Regular expression that matches legal section names. Defaults as described above.
Regular expression that matches comment lines. Default: ^\s*(#.*)$
the Configuration object.
Companion object for the
Configurationclass