Providing more configurable defaults

We can incorporate configuration files along with environment variables and the command-line options. This gives us three ways to provide a configuration to an application program:

  • A hierarchy of configuration files can provide default values. See Chapter 14, Configuration Files and Persistence, for examples of the various ways to do this.
  • Environment variables can provide overrides to the configuration files. This may mean translating from an environment variable namespace to the configuration namespace.
  • The command-line options define the final overrides.

Using all three may be too much of a good thing. Tracking down a setting can become difficult if there are too many places to search. The final decision about the configuration often rests on staying consistent with the overall collection of applications and frameworks. We should strive to make our programming fit seamlessly with other components.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset