13.1 Finding configuration files
Many applications will have a hierarchy of configuration options. The foundation of the hierarchy is often the default values built into the application. These might be supplemented by server-wide (or cluster-wide) values from centralized configuration files. There might also be user-specific files, or perhaps even configuration files provided when starting a program.
In many cases, configuration parameters are written in text files, so they are persistent and easy to change. The common tradition in Linux is to put system-wide configuration in the /etc directory. A user’s personal changes would be in their home directory, often named ~username or $HOME.
In this recipe, we’ll see how an application can support a rich hierarchy of locations for configuration files.
13.1.1 Getting ready
The example we’ll use is an application to simulate dice rolling. The application is shown in several...