Finding configuration files
Many applications will have a hierarchy of configuration options. The foundation of the hierarchy is often the default values built into a particular release. These might be supplemented by server-wide (or cluster-wide) values from centralized configuration files. There might 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.
Getting ready
The example we'll use is a web service that provides hands of cards to users. The service is shown in several recipes throughout Chapter 12, Web Services...