title: Pattern for managing application configuration in a maintainable way
body: <p>I am looking for a DRY pattern for managing application configuration in a cross platform C++ application.</p>
  
  <p>Ideally I would like to have a  single definitive source of application configuration, to minimise the maintenance burden for the developer. This could be stored as txt,XML,JSON,YAML</p>
  
  <p>This file would serve two purposes...</p>
  
  <p>Firstly it be used to create a configuration file that was accessible to the user. </p>
  
  <p>Secondly, it would determine the default values to be used in the case where a user decided to delete all or part of their configuration file.</p>
  
  <h2>Options I have explored...</h2>
  
  <ol>
  <li><p>Having some sort of pre processor compile the configuration file into the application at compile time. This does not appear to be possible.</p></li>
  <li><p>Create a tool  that reads the configuration file, and generates the necessary code to compile in the defaults into the application. This would work, but is adding complexity to our build process which I would like to avoid.</p></li>
  <li><p>Create two configuration files, one that is user configurable, the other that contains the defaults, which are hidden. At application startup the default file is read, and then the user file is read, which applies the user settings by overriding the defaults. This is not ideal as it relies on a hidden file to keep the default values safe from the user.</p></li>
  </ol>