Part three: Configuration

With configuration I mean the compile-time and run-time configuration, and how to get it from parsing command-line arguments and configuration files.

The server will use Boost::program_options for this, and it handles both the command-line argument and configuration file parsing.

The configuration variables will be sectioned of, so network variables will be in a different section from database variables. The variables will be accessed through their names, as a path but with dots instead of slashes. For example, the variable that contains the telnet protocol port can be accessed with the name “net.telnet.port”. This is also the native method of Boost::program_options.

The code containing this will be in the namespace raven::config.


The configuration system is initialized in three steps:

  1. Set default values
  2. Read and parse configuration file
  3. Parse command line arguments

The second step, reading and parsing of the configuration file, includes a partial parsing of the command line arguments, to see if there is a customized path for the configuration file.

Default values

Default values for configuration variables will be placed as constants in the raven::config::default namespace. Code will manually add them to the configuration at program start.


Accessing configuration variables will be done through a get function in the namespace. It will return an object of class boost::program_options::variable_value. This object has conversion functions to convert into the needed types. (See

Leave a Reply