Sane Configuration Method for very Complex Piece of Software?

341 views Asked by At

We are writing a C++ program, that needs to be highly configurable (at start time). Right now we have a base XML file, which contains several configuration variables, and filenames of other XML files with more configuration variables. All in all, we have a tree of about 10 XML files, and several binaries file formats with some other content.

We are now at a point where it is getting extremely messy: Since the files are interlinked, it is difficult to find which files are actually parsed and which configuration needs to be edited or which paths to be set.

Are there any better ways to implement a configuration for a complex piece of software except interlinked XML files?

One advantage of this approach that I'd hate to loose, is that it is relatively easy to switch from one part of the configuration to another. For example we have two configuration files for two different Robots, and to switch between which robot we are using we simply link the correct file from the base XML file.

EDIT Some possible ideas might be:

  • Switch to using a database? This would be highly configurable but is not as human-readable.
  • Some structure like firefox's about:config?
  • One huge flat .ini file and just deal with copying stuff around? not an option, this would be even more cumbersome
  • ...
3

There are 3 answers

0
lhf On BEST ANSWER

Lua was designed for configuration.

2
Joshua Smith On

If you are using C++ you can use

http://www.boost.org/doc/libs/1_45_0/doc/html/program_options.html Boost Program Options.

It allows you to store configs in files and use command line args interchangeably.

0
Khash On

I mostly come from Java and .NET world but can totally understand the pain it involves to have so many configuration files, different envrionments and shared configuration parameters. As one solution for a previous company we started building something which helped us a lot by allowing configuration inheritence, templating and strongly types configuration values as well as auditing and access control for configuration.

We are releasing our solution as a hosted configuration management service soon. If you are interested, signup for a beta at http://woot.configchief.com