Issue 336 2

These patches consolidate the parse of command line options to ConfigManager.
In addition, it also parses a configuration file.
If `foreground` is `true` and `cmdLineOpts.foreground` is `false`, this code doesn't change `foreground` to `false`. Is it OK?