Many applications will have a hierarchy of configuration options. There could be defaults that are built in to a particular release. There might be server-wide (or cluster-wide) values. There might be user-specific values, or perhaps even configuration files that are local to a specific invocation of a program.
In many cases, these configuration parameters will be written in files so that they are 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
.
How can we support a rich hierarchy of locations for configuration files?
The example will be a web service that provides hands of cards to users. The service is shown in several recipes throughout Chapter 10, Web Services. We'll gloss over some details of the service so that we can focus on fetching configuration parameters from a variety of file-system locations.
We'll follow...