Software program configuration
Illustrative Diagrams

Diagram 01. Overview: An environment variable leads to Zaphod's Keybox. Zaphod's Keybox leads to Zaphod's Keys. Zaphod's Keys lead to configuration files.

Zaphod's World...

Zaphod's "map" starts with an environment variable setting named ZaphodsMap, which must be accessible to the program trying to initialize itself.
The environment variable points to the full path and filename of the central ZaphodsKeybox.xml file.
A Keybox is a box containing groups of keys. ZaphodsKeybox is for software keys.
ZaphodsKeybox is ... an XML file containing groups of keys. One program usually requires only one group of keys, but it can use more if needed.
Each "key" is a reference to a single configuration file. Configuration files may have any file extension, and may be in any format, including INI and XML.

Zaphod's Variables...

Variables defined at the top level of ZaphodsKeybox are global and can be used within any key's filename.

Variables defined within a KeyGroup apply only to keys within that group.


Example File Contents

Please remember the following is only ONE (1) example! Hundreds of variations are possible and encouraged.

Starting Point Example

SET ZaphodsMap=d:\AppsData\ZaphodsMap\ZaphodsKeybox.xml

ZaphodsKeybox.xml Example

In the following example, three programs ("StreamCatcher", "SlimLogger" and "WebHub") are using ZaphodsKeybox. Each program uses its own KeyGroup.

Also shown are two optional ZaphodOverrides, giving the machine administrator more control of the configuration. The DefaultContext will be explained in detail below. The LocalKeyboxSuffix provides the name of a file, which if found in the same directory as the compiled binary program, always takes precedence over the central keybox.

The programmer decides on the KeyGroup and Key names.

Contents of ZaphodsKeybox.xml

SecurityConfig Example

Both StreamCatcher and SlimLogger have settings which should be kept secure. Generally speaking, any setting whose value should be known only by an "Administrator" or machine owner should be isolated in its own configuration file. Examples of settings which are best kept isolated are:

software unlock code.

absolute path to database.

absolute path to report templates.

administrator level username and/or password.

Contents of SCConfig_Security.xml

Master File Example

All non-secure settings are kept in the master configuration file. The master configuration file can be considered more public, and perhaps edited through a web interface.

The master file might point to additional configuration files, which might be read, or controlled by, users of the software.

Contents of SCConfig_Master.xml


Diagram 02. Overrides by context: This example shows how a setting such as "HubAppID" can be defined for the context "office" in the same file as a setting for the context "home". Only one context applies at a time. The administrator can see and maintain all values at once.



Creative Commons License This web site content is licensed under a Creative Commons Attribution 2.5 License. The ZaphodsMap web site is published by HREF Tools Corp. If you use ZaphodsMap, please mention ZaphodsMap.com at least once in your software source and at least once in your software documentation. All other trademarks are the property of their respective owners.