From: Joby W. <joby@u.washington.edu> - 2002-09-17 19:18:01
|
A proposal: My solution is a bit more complicated (because there are four elements), but it would involve a lot less parsing and allow for multiple methods of configuration. The current proposal is for three parts: 1) config-dist.php -> Default distribution config settings 2) config-user.php -> Implimentation's config settings 3) Configurator.php -> elements to configure via wiki The current debate is whether to put the validation elements in config-dist.php (as notes in the comments) or Configurator.php (would just be code). Since the validation of settings is really a seperate function, I would just make it a fourth file, thus: Config elements: 1) config-dist.php -> Default distribution config settings 2) config-user.php -> Implimentation's config settings 3) config-valid.php -> defines what is a valid data for a setting (authoritative source). Config applications: 1) Configurator.php -> elements to configure via wiki 2) cli-config.php -> config via command line n) more options, such as a plugin to a web management app (webmin), a GUI app (Gnome or KDE), or perhaps a ncurses app. config-dist.php and config-user.php would just be the define()s and variables set. config-valid.php would contain classes to validate configuration data and the authoritative settings, such as: ------------------------------------- class valid_bool{ valid_bool($variable){} get_default(){} get_current(){} get_description(){} is_valid($new){ if(is_bool($new)){ $this->new = $new; return true; } } get_new(){ if(isset($new)){ return $new; } else { return $current; } } } $reverseDNS = array( 'type' => 'boolean', 'define' => true, // true if use define, else variable 'name' => 'ENABLE_REVERSE_DNS', 'description' => "If set, we will perform..."); $valid_reverseDNS = new valid_bool($reverseDNS); ----------------------------------------------- The above is really rough and just for the idea. In this situation, when someone starts a virginwiki and the Configurator.php file is called the config-dist.php file would be generated from this config.valid file -- thus config-valid.php would be the authoritative source. Configurator.php and cli-config.php would just know how to use the tools presented by config-valid.php and generate an interface. jbw |