Have your program read a pair of configuration files for its settings. First, it should read a config.defaults
file that would be included in the repository. Then, it should read a config.local
file that should be listed in .gitignore
With this arrangement, new settings appear in the defaults file and take effect as soon as it’s updated. They will only vary on particular systems if they’re overridden.
As a variation on this, you could have just a general config
file that you ship in version control, and have it do something like include config.local
to bring in the machine-specific values. This introduces a more general mechanism (versus policy) in you code, and consequently enables more complicated configurations (if that’s desirable for your application). The popular extension from this, seen in many large-scale open-source software, is to include conf.d
, which reads configuration from all the files in a directory.
Also see my answer to a similar question.