Jeremy Zawodny wrote:
If the client and server allowed the config file to support an
"include" directive (dir or file, like apache) that would provide a
lot of flexibility for those who want to go beyond the basics or
configure things w/out fighting their OS package management tools, etc.
The configuration system I wrote for NimbusDB does just that.
Configuration parameters can be as switches or in configuration file,
include the "use" (--use) that includes another configuration file, up
to some arbitrary depth. Later parameters override earlier parameters,
so even a basic configuration file can be override for, say, testing.
NimbusDB doesn't have a default configuration file at all, depending on
command line switches (one of which is likely to be a --use <file>).
The implementation is a base class that does the basic parsing and
processing and a subclass that defines an instance. The subclass for
NimbusDB uses an omnibus NimbusSwitches.h that is included in three or
four places with in the subclass to make adding parameters a single line
affair. The definitions for the parameters show up in the subclass.
Part of the motivation was to centralize all configuration information
so it can be tweaked while a server is running across a network connection.
If I were doing it something like drizzle, I'd seriously consider
letting components has separate configuration objects to handle switches
and parameters for loadable objects. That would mean cycling parameter
through a hierarchy of configuration objects...
If anyone is interested, I'd be happy to post the class definitions
(free, as in beer).
Here is a snippet from the NimbusSwitches.h
Sorry, I forgot to include a sample set of switch definition from my
NimbusDB configuration system:
NimbusSwitches.h
STRING ("--archive", archive, NULL, "Archive Directory")
SWITCH ("--background", background,NULL, "Run in background")
SWITCH ("--debug", debug, NULL, "Debug image")
SWITCH ("--force", force, NULL, "Overwrite existing
archive")
STRING ("--cloud", cloudName, NULL, "Cloud name")
NUMBER ("--disk", diskBandwidth, "55M", "Max disk bandwidth (
bytes per second)")
The file is included to:
* Define enums for switch numbers
* Define the switch definition structure
* Define switch cases to handle individual parameters
* Define the class variables in the configuration class
With one file, nothing can to wrong...
--
Jim Starkey
President, NimbusDB, Inc.
978 526-1376
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : drizzle-discuss@lists.launchpad.net
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp